[cfe-dev] Not Warning About Invalid C Code

Bill Wendling isanbard at gmail.com
Sat Sep 8 17:59:48 PDT 2007


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.

-bw



More information about the cfe-dev mailing list