Type qualifiers

Hi Guys ,

gcc pop up with the error for the below sample

[root@insiscssgs06 ~]# cat test.c
int main()
int i ;
int a[ const i =10] ;
while (i <10)

[root@insiscssgs06 ~]# gcc test.c
test.c: In function âmainâ:
test.c:4: error: static or type qualifiers in non-parameter array declarator

[root@insiscssgs06 ~]# gcc --version
gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)

But ,The same compiles with clang

[root@insiscssgs06 ~]# clang --version
clang version 3.2 (trunk) (llvm/trunk 158444)
Target: i386-pc-linux-gnu
Thread model: posix
[root@insiscssgs06 ~]# clang test.c

According to c99 in the section 6.7 the clang is right.Before i report a bug in the GCC .Any thoughts or inputs or suggestions ???

Please forgive me ,if its not the right group.


This is definitely our bug, not GCC's:

  The optional type qualifiers and the keyword static shall appear only in a declaration of a function parameter with an array type, and then only in the outermost array type derivation.

So please file your bug at http://llvm.org/bugs/ rather than gnu.org. :slight_smile:

This should be simple for us to check and fix.


I sent a patch to cfe-commits: