-Wtype-limits support

-Wtype-limits support


I used the same compiler flags of gcc when using icc. So, when I used -Wall and -Wextra for the below code, I was expecting a warning of pointless comparison (which is always true) from icc. However, I got no warning and it seems -Wtype-limits is not included in -Wall or -Wextra. Actually, -Wextra of gcc enables -Wtype-limits.

#include <stdio.h>

int main()
    size_t off = 10;
    if (off >= 0) {
        printf("off=%lu\n", off);
    return 0;

If I explicitly use -Wtype-limits, icc generates the warning:
warning.c(6): warning #186: pointless comparison of unsigned integer with zero
      if (off >= 0) {

My question is whether -Wtype-limits is officially supported in the Intel Compiler or not. If so, I also want to know if it is documented somewhere. I could not find any information about -Wtype-limits from the Intel Compiler manual or man page.

Thanks in advance,


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.


We do not re-document all the -W options ourselves since they are supposed to be compatible with the GNU options. Please look at the GNU man page or online docs. We only document options that are specific to Intel or are intentionally different when used with Intel.

It sounds like the -Wtype-limits option is working as expected (or else you would have gotten a warning from the driver about ignoring an unknown option).

The only problem seems to be that it not included in -Wextra, is that correct? I have submitted a problem report for that as :DPD200357763.

Thanks for letting us know.


Yes, -Wtype-limits flag is currently working in icc but it is not included in -Wextra.

Thanks for the reply.


Leave a Comment

Please sign in to add a comment. Not a member? Join today