11595 – [3.3 Regression] crash on duplicate label definition (original) (raw)

| Description Zack Weinberg 2003-07-19 21:32:25 UTC This code crashes the C++ compiler: extern void a(void); void b(void) { l: a(); l: a(); goto l; } sample output: test.cc: In function `void b()': test.cc:6: error: duplicate label `l' test.cc:6: internal compiler error: Segmentation fault 2.95 does not crash, but 3.2, 3.3, 3.4 all do. (3.2 and 3.3 print "confused by earlier errors, bailing out" instead of the ICE message - this is normal ICE-after-error suppression.) Stack crawl: Program received signal SIGSEGV, Segmentation fault. label_rtx (label=0x0) at /home/zack/src/gcc/vanilla/gcc/stmt.c:490 490 if (TREE_CODE (label) != LABEL_DECL) (gdb) bt #0 label_rtx (label=0x0) at /home/zack/src/gcc/vanilla/gcc/stmt.c:490 #1 0x083a8207 in expand_label (label=0x0) at /home/zack/src/gcc/vanilla/gcc/stmt.c:584 During symbol reading, unsupported stack op: 'DW_OP_piece'. During symbol reading, unsupported stack op: 'DW_OP_piece'. #2 0x0816ea23 in expand_stmt (t=0x4019cf14) at /home/zack/src/gcc/vanilla/gcc/c-semantics.c:850 #3 0x0816e11d in genrtl_compound_stmt (t=0x4019ce9c) at /home/zack/src/gcc/vanilla/gcc/c-semantics.c:722 #4 0x0816e689 in expand_stmt (t=0x4019ce9c) at /home/zack/src/gcc/vanilla/gcc/c-semantics.c:828 #5 0x0816e11d in genrtl_compound_stmt (t=0x4019ce60) at /home/zack/src/gcc/vanilla/gcc/c-semantics.c:722 #6 0x0816e689 in expand_stmt (t=0x4019ce60) at /home/zack/src/gcc/vanilla/gcc/c-semantics.c:828 #7 0x0813b9c7 in expand_body (fn=0x401a972c) at /home/zack/src/gcc/vanilla/gcc/cp/semantics.c:2789 #8 0x081000ba in cp_parser_function_definition_after_declarator ( parser=0x401ab0c0, inline_p=44) at /home/zack/src/gcc/vanilla/gcc/cp/parser.c:13433 #9 0x08100032 in cp_parser_function_definition_from_specifiers_and_declarator (parser=0x401ab0c0, decl_specifiers=0x400183a0, attributes=0x400183a0, declarator=0x400183a0) at /home/zack/src/gcc/vanilla/gcc/cp/parser.c:13372 #10 0x080fada3 in cp_parser_init_declarator (parser=0x401ab0c0, decl_specifiers=0x4019cdfc, prefix_attributes=0x0, function_definition_allowed_p=true, member_p=false, function_definition_p=0xbfffdef3) at /home/zack/src/gcc/vanilla/gcc/cp/parser.c:9233 #11 0x080f7d7d in cp_parser_simple_declaration (parser=0x401ab0c0, function_definition_allowed_p=true) at /home/zack/src/gcc/vanilla/gcc/cp/parser.c:6113 #12 0x080f7c44 in cp_parser_block_declaration (parser=0x401ab0c0, statement_p=false) at /home/zack/src/gcc/vanilla/gcc/cp/parser.c:6030 #13 0x080f7afd in cp_parser_declaration (parser=0x0) at /home/zack/src/gcc/vanilla/gcc/cp/parser.c:5950 #14 0x080f79a8 in cp_parser_declaration_seq_opt (parser=0x0) at /home/zack/src/gcc/vanilla/gcc/cp/parser.c:5859 #15 0x080f4062 in cp_parser_translation_unit (parser=0x401ab0c0) at /home/zack/src/gcc/vanilla/gcc/cp/parser.c:2136 #16 0x081013e1 in c_parse_file () at /home/zack/src/gcc/vanilla/gcc/cp/parser.c:14314 #17 0x0817b31b in c_common_parse_file (set_yydebug=1073841056) at /home/zack/src/gcc/vanilla/gcc/c-opts.c:1212 #18 0x083bbe2a in compile_file () at /home/zack/src/gcc/vanilla/gcc/toplev.c:1749 #19 0x083c06ee in do_compile () at /home/zack/src/gcc/vanilla/gcc/toplev.c:4526 #20 0x083c0805 in toplev_main (argc=1073841056, argv=0xbfffe0b4) at /home/zack/src/gcc/vanilla/gcc/toplev.c:4567 #21 0x400434ad in __libc_start_main () from /lib/libc.so.6 The offending LABEL_STMT: <label_stmt 0x4019cf14 tree_1 chain <expr_stmt 0x4019cf3c tree_1 arg 0 <call_expr 0x40021300 type <void_type 0x4015bb64 void> side-effects arg 0 <addr_expr 0x4019cf28 type <pointer_type 0x401a9a8c> constant arg 0 <function_decl 0x401a9654 b>>> chain <goto_stmt 0x4019cf50 tree_1 arg 0 <label_decl 0x401a9a20 l> chain <scope_stmt 0x4019cf64 tree_1>>>> LABEL_STMT_LABEL for this is NULL. Comment 1 Drea Pinski 2003-07-19 21:37:34 UTC I can confirm gcc ICE on the mainline (20030719) and it did not ICE on 2.95.3 Comment 2 Drea Pinski 2003-07-19 21:40:22 UTC Also using Phil's regression hunter, 2000-12-31 ICE's also. Also 2.96 20000731 (Red Hat Linux 7.2 2.96-109) (yes I know that is not a released version but still), it also ICEs. Comment 4 Zack Weinberg 2003-08-01 21:25:36 UTC Steven: please add the test case to the C++ test suite, verify with a bootstrap cycle, and send a complete patch to gcc-patches. Comment 5 Steven Bosscher 2003-09-04 10:05:36 UTC It _is_ a regression, after all. Comment 6 Wolfgang Bangerth 2003-09-04 14:37:28 UTC Steven, did you close the PR by accident? It still fails for me as of this night, and I don't see any CVS commits in the audit trail. W. Comment 7 Wolfgang Bangerth 2003-09-04 14:37:59 UTC Still fails. Comment 8 s.bosscher 2003-09-04 15:03:05 UTC Subject: RE: [3.3/3.4 Regresion] crash on duplicate label definition Well, if I closed it something went wrong. I want to "accept" the bug as one that I will formally submit a patch for soon. -----Original Message----- From: bangerth at dealii dot org To: steven@gcc.gnu.org Sent: 9/4/03 4:37 PM Subject: [Bug c++/11595] [3.3/3.4 Regresion] crash on duplicate label definition PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11595 bangerth at dealii dot org changed: What |Removed | Added ------------------------------------------------------------------------ ---- CC| | steven at gcc dot gnu dot | | org Last reconfirmed|2003-09-04 10:04:28 | 2003-09-04 14:37:30 date| | ------- Additional Comments From bangerth at dealii dot org 2003-09-04 14:37 ------- Steven, did you close the PR by accident? It still fails for me as of this night, and I don't see any CVS commits in the audit trail. W. ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. Comment 9 Steven Bosscher 2003-09-04 15:03:42 UTC Repeat after me: RADIO BUTTONS SUCK Comment 10 Steven Bosscher 2003-09-04 15:04:51 UTC Oh great, and now Bugzilla let's me assign to "unassigned at gcc.gnu.org", WTF!? Comment 11 Steven Bosscher 2003-09-06 14:26:02 UTC Comment on attachment 4504 [details] This should fix it Index: decl.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v retrieving revision 1.1121 diff -c -p -3 -r1.1121 decl.c *** decl.c 4 Sep 2003 03🔞02 -0000 1.1121 --- decl.c 6 Sep 2003 14:12:36 -0000 *************** check_goto (tree decl) *** 4937,4944 **** } /* Define a label, specifying the location in the source file. ! Return the LABEL_DECL node for the label, if the definition is valid. ! Otherwise return 0. */ tree define_label (location_t location, tree name) --- 4937,4943 ---- } /* Define a label, specifying the location in the source file. ! Return the LABEL_DECL node for the label. */ tree define_label (location_t location, tree name) *************** define_label (location_t location, tree *** 4961,4970 **** pedwarn ("label named wchar_t"); if (DECL_INITIAL (decl) != NULL_TREE) ! { ! error ("duplicate label `%D'", decl); ! POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE); ! } else { /* Mark label as having been defined. */ --- 4960,4966 ---- pedwarn ("label named wchar_t"); if (DECL_INITIAL (decl) != NULL_TREE) ! error ("duplicate label `%D'", decl); else { /* Mark label as having been defined. */ *************** define_label (location_t location, tree *** 4977,4985 **** ent->binding_level = current_binding_level; } check_previous_gotos (decl); - POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl); } ! timevar_pop (TV_NAME_LOOKUP); } struct cp_switch --- 4973,4981 ---- ent->binding_level = current_binding_level; } check_previous_gotos (decl); } ! ! POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl); } struct cp_switch Comment 12 Steven Bosscher 2003-09-06 15:43:53 UTC Fixed for mainline Comment 15 Steven Bosscher 2003-09-09 07:30:37 UTC fixed | | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------------- | | ------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |