[cfe-dev] Not Warning About Invalid C Code
Steve Naroff
snaroff at apple.com
Sat Sep 8 20:17:26 PDT 2007
On Sep 8, 2007, at 5:59 PM, Bill Wendling wrote:
> Hi all,
>
> This program:
>
> struct t {
> unsigned long l;
> };
>
> void g(struct t *);
>
> void bork() {
> const unsigned long v = 'vcgt';
> struct t A = { v };
>
> g(&A);
> }
>
> Should warn for C89/C90, but doesn't even with -pedantic set. Here's
> what GCC produces:
>
> $ gcc t.c -pedantic -c
> t.c: In function 'bork':
> t.c:9: warning: initializer element is not computable at load time
>
> Without the -pedantic flag, gcc accepts this without warning.
>
This is because Sema::CheckInitializer() doesn't type check structs
yet (for any dialect).
Finishing type checking for initializers is on the short list...
snaroff
> -bw
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list