diff mbox

Fix -g3 on Windows

Message ID 2225321.oc0fT1EooQ@polaris
State New
Headers show

Commit Message

Eric Botcazou Dec. 1, 2013, 12:18 p.m. UTC
Any compiler configured to target Windows with tree checking breaks on -g3:

eric@polaris:~/gnat/bugs/MB28-035> ~/build/gcc/i686-pc-mingw32/gcc/cc1 -quiet 
-g3 t.c
t.c:1:0: internal compiler error: tree check: expected tree that contains 
'decl common' structure, have 'identifier_node' in i386_pe_asm_named_section, 
at config/i386/winnt.c:569

Without tree checking, e.g. on release branches, you get sometimes a segfault.  
The reason is that i386_pe_asm_named_section takes DECL_ATTRIBUTES of an 
IDENTIFIER_NODE.  The latter is valid here, see default_elf_asm_named_section.

This is a (somewhat old) regression, tested on i686-pc-mingw32, applied on all 
active branches as obvious.


2013-12-01  Eric Botcazou  <ebotcazou@adacore.com>

	* config/i386/winnt.c (i386_pe_asm_named_section): Be prepared for an
	identifier node.
diff mbox

Patch

Index: config/i386/winnt.c
===================================================================
--- config/i386/winnt.c	(revision 205562)
+++ config/i386/winnt.c	(working copy)
@@ -565,8 +565,9 @@  i386_pe_asm_named_section (const char *n
 	 sets 'discard' characteristic, rather than telling linker
 	 to warn of size or content mismatch, so do the same.  */ 
       bool discard = (flags & SECTION_CODE)
-		      || lookup_attribute ("selectany",
-					   DECL_ATTRIBUTES (decl));	 
+		      || (TREE_CODE (decl) != IDENTIFIER_NODE
+			  && lookup_attribute ("selectany",
+					       DECL_ATTRIBUTES (decl)));
       fprintf (asm_out_file, "\t.linkonce %s\n",
 	       (discard  ? "discard" : "same_size"));
     }