diff mbox

Fix ICE during diagnosing of section conflict (PR middle-end/52999)

Message ID 20120423225749.GM16117@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek April 23, 2012, 10:57 p.m. UTC
Hi!

If a user decl conflicts with a use of a section without a decl
(usually rtx constant), then we can ICE in get_section.
This patch fixes it, to print the error that has been printed in older gcc
versions.  Bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk/4.7?

2012-04-23  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/52999
	* varasm.c (get_section): Don't ICE for section conflicts with
	built-in section kinds.


	Jakub

Comments

Richard Henderson April 23, 2012, 11:26 p.m. UTC | #1
On 04/23/12 15:57, Jakub Jelinek wrote:
> 2012-04-23  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR middle-end/52999
> 	* varasm.c (get_section): Don't ICE for section conflicts with
> 	built-in section kinds.

Ok everywhere.


r~
diff mbox

Patch

--- gcc/varasm.c.jj	2012-04-23 11:11:21.000000000 +0200
+++ gcc/varasm.c	2012-04-23 11:38:11.990408562 +0200
@@ -314,11 +314,16 @@  get_section (const char *name, unsigned
 	  if (decl == 0)
 	    decl = sect->named.decl;
 	  gcc_assert (decl);
-	  error ("%+D causes a section type conflict with %D", 
-			decl, sect->named.decl);
-	  if (decl != sect->named.decl)
-            inform (DECL_SOURCE_LOCATION (sect->named.decl), 
-		    "%qD was declared here", sect->named.decl);
+	  if (sect->named.decl == NULL)
+	    error ("%+D causes a section type conflict", decl);
+	  else
+	    {
+	      error ("%+D causes a section type conflict with %D",
+		     decl, sect->named.decl);
+	      if (decl != sect->named.decl)
+		inform (DECL_SOURCE_LOCATION (sect->named.decl),
+			"%qD was declared here", sect->named.decl);
+	    }
 	  /* Make sure we don't error about one section multiple times.  */
 	  sect->common.flags |= SECTION_OVERRIDE;
 	}