For struct X { int i; int j[2]; }; const long x = ((struct X *)0)->j - (int *)0; char a[((struct X *)0)->j - (int *)0]; char b[__builtin_offsetof(struct X, j)]; char c[x];
we now issue the following diagnostics: > gcc-4.5 -S t.i t.i:3:17: warning: variably modified a at file scope t.i:5:6: error: variably modified c at file scope compared to > gcc-4.4 -S t.i t.i:5: error: variably modified c at file scope which didn't warn about the declaration of a. I would expect a warning for x as well if we warn about a. And of course I'd have expected c to work anyway. ICC accepts all of the above without a diagnostic including c. I consider rejecting c errorneous and the inconsistent warning about a and x at least annoying. Only the warning is a regression. -- Summary: [4.5 Regression] Inconsistent diagnostic Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: rejects-valid, diagnostic Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43151