re PR target/52999 (ICE, segmentation fault in c_tree_printer)
authorJakub Jelinek <jakub@redhat.com>
Tue, 24 Apr 2012 06:03:43 +0000 (08:03 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 24 Apr 2012 06:03:43 +0000 (08:03 +0200)
PR middle-end/52999
* varasm.c (get_section): Don't ICE for section conflicts with
built-in section kinds.

From-SVN: r186741

gcc/ChangeLog
gcc/varasm.c

index 1cdac985ac5b2b00834c12dae655794bd1a5236c..f3992e1b8b2715ec32dcd6cd081e4b935837c3e7 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/52999
+       * varasm.c (get_section): Don't ICE for section conflicts with
+       built-in section kinds.
+
 2012-04-23  DJ Delorie  <dj@redhat.com>
 
        * config/s390/s390.h (LINK_SPEC): Remove, no longer needed.
index c3d289eb91a057324ea97af9612c3a5f6756e0e1..b7939c54a848290615594bde74ba74020e9f6528 100644 (file)
@@ -1,7 +1,7 @@
 /* Output variables, constants and external declarations, for GNU compiler.
    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
    1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-   2010, 2011  Free Software Foundation, Inc.
+   2010, 2011, 2012  Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -314,11 +314,16 @@ get_section (const char *name, unsigned int flags, tree decl)
          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;
        }