]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/55033 (PowerPC section type conflict error)
authorAlan Modra <amodra@gmail.com>
Fri, 10 May 2013 01:06:49 +0000 (10:36 +0930)
committerAlan Modra <amodra@gcc.gnu.org>
Fri, 10 May 2013 01:06:49 +0000 (10:36 +0930)
PR target/55033
* varasm.c (default_elf_select_section): Move !DECL_P check..
(get_named_section): ..to here before calling get_section_name.
Adjust assertion.
(default_section_type_flags): Add DECL_P check.
* config/i386/winnt.c (i386_pe_section_type_flags): Likewise.
* config/rs6000/rs6000.c (rs6000_xcoff_section_type_flags): Likewise.

From-SVN: r198762

gcc/ChangeLog
gcc/config/i386/winnt.c
gcc/config/rs6000/rs6000.c
gcc/varasm.c

index fe4c00af7e14b363428fee1b9c663a41c4afcf67..f1ffb432d1406d18f35d9b2354b06e2d206eb619 100644 (file)
@@ -1,3 +1,13 @@
+2013-05-10  Alan Modra  <amodra@gmail.com>
+
+       PR target/55033
+       * varasm.c (default_elf_select_section): Move !DECL_P check..
+       (get_named_section): ..to here before calling get_section_name.
+       Adjust assertion.
+       (default_section_type_flags): Add DECL_P check.
+       * config/i386/winnt.c (i386_pe_section_type_flags): Likewise.
+       * config/rs6000/rs6000.c (rs6000_xcoff_section_type_flags): Likewise.
+
 2013-05-09  Joern Rennecke  <joern.rennecke@embecosm.com>
 
        * config/epiphany/epiphany.c (epiphany_expand_prologue):
index c8002f6723f416f9e0968d6d8d25cbd8f35bac45..f0f972c56d9d07f83be683d9749619d940e2a1eb 100644 (file)
@@ -476,7 +476,7 @@ i386_pe_section_type_flags (tree decl, const char *name, int reloc)
        flags |= SECTION_PE_SHARED;
     }
 
-  if (decl && DECL_ONE_ONLY (decl))
+  if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl))
     flags |= SECTION_LINKONCE;
 
   /* See if we already have an entry for this section.  */
index b30d47db00ab377be095082a9bf184ebdcc50764..e82b24e22cee748ed9bc8e9e0871a18a2b5994b4 100644 (file)
@@ -26029,7 +26029,7 @@ rs6000_xcoff_section_type_flags (tree decl, const char *name, int reloc)
   unsigned int flags = default_section_type_flags (decl, name, reloc);
 
   /* Align to at least UNIT size.  */
-  if (flags & SECTION_CODE || !decl)
+  if ((flags & SECTION_CODE) != 0 || !decl || !DECL_P (decl))
     align = MIN_UNITS_PER_WORD;
   else
     /* Increase alignment of large objects if not already stricter.  */
index 2532d804214c332fa43170078186ced103e4bc0f..6fb49cfa2d223a618fe8c1684f24800a40c9292d 100644 (file)
@@ -402,12 +402,16 @@ get_named_section (tree decl, const char *name, int reloc)
 {
   unsigned int flags;
 
-  gcc_assert (!decl || DECL_P (decl));
   if (name == NULL)
-    name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
+    {
+      gcc_assert (decl && DECL_P (decl) && DECL_SECTION_NAME (decl));
+      name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
+    }
 
   flags = targetm.section_type_flags (decl, name, reloc);
 
+  if (decl && !DECL_P (decl))
+    decl = NULL_TREE;
   return get_section (name, flags, decl);
 }
 
@@ -5990,7 +5994,7 @@ default_section_type_flags (tree decl, const char *name, int reloc)
        flags |= SECTION_RELRO;
     }
 
-  if (decl && DECL_ONE_ONLY (decl))
+  if (decl && DECL_P (decl) && DECL_ONE_ONLY (decl))
     flags |= SECTION_LINKONCE;
 
   if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
@@ -6349,8 +6353,6 @@ default_elf_select_section (tree decl, int reloc,
       gcc_unreachable ();
     }
 
-  if (!DECL_P (decl))
-    decl = NULL_TREE;
   return get_named_section (decl, sname, reloc);
 }