http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59520
Bug ID: 59520 Summary: a possible inconsistency in error diagnostics with "-pedantic -std=c99" Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu I wonder whether or not the following examples illustrate an unintended inconsistency with error diagnostics in GCC. In particular, should the diagnostic message be a warning for error3.c rather than an error as shown below? error3.c:1:5: error: zero or negative size array ‘a’ int a[] = {}; ^ --------------- $ gcc-trunk -pedantic -std=c99 -c error1.c error1.c:1:12: warning: ISO C forbids empty initializer braces [-Wpedantic] int a[1] = {}; ^ $ clang-trunk -pedantic -std=c99 -c error1.c error1.c:1:12: warning: use of GNU empty initializer extension [-Wgnu-empty-initializer] int a[1] = {}; ^ 1 warning generated. $ cat error1.c int a[1] = {}; $ --------------- $ gcc-trunk -pedantic -std=c99 -c error2.c error2.c:1:5: warning: array ‘a’ assumed to have one element [enabled by default] int a[]; ^ $ clang-trunk -pedantic -std=c99 -c error2.c error2.c:1:5: warning: tentative array definition assumed to have one element int a[]; ^ 1 warning generated. $ cat error2.c int a[]; $ --------------- $ gcc-trunk -pedantic -std=c99 -c error3.c error3.c:1:11: warning: ISO C forbids empty initializer braces [-Wpedantic] int a[] = {}; ^ error3.c:1:5: error: zero or negative size array ‘a’ int a[] = {}; ^ $ clang-trunk -pedantic -std=c99 -c error3.c error3.c:1:11: warning: use of GNU empty initializer extension [-Wgnu-empty-initializer] int a[] = {}; ^ error3.c:1:11: warning: zero size arrays are an extension [-Wzero-length-array] 2 warnings generated. $ cat error3.c int a[] = {}; $