[cfe-dev] Type qualifiers
Hans Wennborg
hans at chromium.org
Mon Aug 6 11:14:59 PDT 2012
On Thu, Aug 2, 2012 at 7:51 AM, John McCall <rjmccall at apple.com> wrote:
> On Aug 1, 2012, at 11:24 PM, Umesh Kalappa wrote:
>> gcc pop up with the error for the below sample
>>
>> [root at insiscssgs06 ~]# cat test.c
>> int main()
>> {
>> int i ;
>> int a[ const i =10] ;
>> while (i <10)
>> a[i++]=i;
>> }
>>
>> [root at insiscssgs06 ~]# gcc test.c
>> test.c: In function âmainâ:
>> test.c:4: error: static or type qualifiers in non-parameter array declarator
>>
>> [root at insiscssgs06 ~]# gcc --version
>> gcc (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3)
>>
>> But ,The same compiles with clang
>>
>> [root at insiscssgs06 ~]# clang --version
>> clang version 3.2 (trunk) (llvm/trunk 158444)
>> Target: i386-pc-linux-gnu
>> Thread model: posix
>> [root at 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 ???
>
> This is definitely our bug, not GCC's:
>
> C99 6.7.6.2p1:
> 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. :)
>
> This should be simple for us to check and fix.
I sent a patch to cfe-commits:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120806/061951.html
Thanks,
Hans
More information about the cfe-dev
mailing list