[BUG] icc accepts -std=c11 but doesn't conform

[BUG] icc accepts -std=c11 but doesn't conform

$ icc -V Intel(R) C Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.1.106 Build 20131008 Copyright (C) 1985-2013 Intel Corporation.  All rights reserved. Although not documented icc accepts both -std=c11 and -std=gnu11, however it doesn't behave as C11 compiler, not even C99. It seems it would fall back to the default (as though I didn't specify -std). This is highly annoying in automatic environments (such as autoconf) where C11 compilers are preferred to C99 compilers, and in particular might fail for C99 code bases.

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

Hi,

    Could you please provide me a test case to reproduce the issue that you are speaking about?

Regards,

Sukruth H V

Dear,

I agree this seems to be a bug of ICC. I did not see any document saying about supporting c11 too, it should report something like: icc: command line warning #10159: invalid argument for option '-std'.

I am not sure about new features of c11, but I guess c99 is a subset of c99, so I tested with a C99 feature and reproduce the issue:

#cat foo.c
void foo(int* restrict test) {}
#icc -std=c11 foo.c -c
foo.c(1): error: expected a ")"
  void foo(int* restrict test) {}
                         ^

compilation aborted for foo.c (code 2)
#icc -std=c99 foo.c -c
#icc -std=wrong_arg foo.c -c
icc: command line warning #10159: invalid argument for option '-std'
foo.c(1): error: expected a ")"
  void foo(int* restrict test) {}
                         ^

compilation aborted for foo.c (code 2)
#

Also, I checked with "-#" and I can see with -std=c11, it is ignored (fall back to default). And with -stc=c99, I can see an additional option (--c99) applied.

 

I will submit the issue to developer to fix.

 

Thanks,

Shenghong

FYI. This issue is fixed in v15.0. With C11, it will at least support C99 features.

# source /opt/intel/composer_xe_2013_sp1.1.106/bin/compilervars.sh intel64
# icc -std=c11 temp.c -c
temp.c(1): error: expected a ")"
  void foo(int* restrict test) {}
                         ^

compilation aborted for temp.c (code 2)
# icc -v
icc version 14.0.1 (gcc version 4.8.0 compatibility)
# source /opt/intel/composer_xe_2015.1.133/bin/compilervars.sh intel64
# icc -std=c11 temp.c -c
# icc -v
icc version 15.0.1 (gcc version 4.8.1 compatibility)
# cat temp.c
void foo(int* restrict test) {}
#

 

Leave a Comment

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