http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47435

           Summary: [4.6 Regression] ICE: SIGSEGV in c_finish_case
                    (c-typeck.c:8859) on invalid code
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: zso...@seznam.cz


Created attachment 23097
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23097
reduced testcase

Compiler output:
$ gcc testcase.c
testcase.c: In function 'foo':
testcase.c:5:5: error: a label can only be part of a statement and a
declaration is not a statement
testcase.c:5:5: error: unknown type name 'x'
testcase.c:6:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before
'}' token
testcase.c:4:5: error: label at end of compound statement
==28038== Invalid read of size 8
==28038==    at 0x513058: c_finish_case (c-typeck.c:8859)
==28038==    by 0x535EF4: c_parser_statement_after_labels (c-parser.c:4626)
==28038==    by 0x5372A7: c_parser_compound_statement_nostart (c-parser.c:4109)
==28038==    by 0x538838: c_parser_compound_statement (c-parser.c:3946)
==28038==    by 0x534F0A: c_parser_declaration_or_fndef (c-parser.c:1719)
==28038==    by 0x539F8D: c_parser_external_declaration (c-parser.c:1332)
==28038==    by 0x53AB67: c_parse_file (c-parser.c:1220)
==28038==    by 0x574804: c_common_parse_file (c-opts.c:1071)
==28038==    by 0x8DD507: toplev_main (toplev.c:579)
==28038==    by 0x62FEBBC: (below main) (in /lib64/libc-2.11.2.so)
==28038==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==28038== 
testcase.c:6:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


Output - 4.5:
$ gcc testcase.c testcase.c: In function 'foo':
testcase.c:5:5: error: 'x' undeclared (first use in this function)
testcase.c:5:5: note: each undeclared identifier is reported only once for each
function it appears in
testcase.c:5:7: error: expected ';' before 'y'

The diagnostics given by 4.5 was probably more helpful.

Tested revisions:
r169155 - crash
4.5 r168785 - OK

Reply via email to