re PR middle-end/61558 (ICE: Segmentation fault)
authorJan Hubicka <hubicka@ucw.cz>
Mon, 15 Dec 2014 03:44:58 +0000 (04:44 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 15 Dec 2014 03:44:58 +0000 (03:44 +0000)
PR ipa/61558
* symtab.c (symbol_table::insert_to_assembler_name_hash
symbol_table::unlink_from_assembler_name_hash): Do not ICE when
DECL_ASSEMBLER_NAME is NULL.

From-SVN: r218729

gcc/ChangeLog
gcc/symtab.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr61558.C [new file with mode: 0644]

index 1c637f6a4152b17cecfa84233106442878c5464d..253db82911e00b7f7d527dc53bb4ffb627d371f4 100644 (file)
@@ -1,3 +1,10 @@
+2014-12-14  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/61558
+       * symtab.c (symbol_table::insert_to_assembler_name_hash
+       symbol_table::unlink_from_assembler_name_hash): Do not ICE when 
+       DECL_ASSEMBLER_NAME is NULL.
+
 2014-12-14  Jan Hubicka  <hubicka@ucw.cz>
 
        * cgraphunit.c (analyze_functions): Always analyze targets of aliases.
index 101bc25ac410325bdfa7e81b47d5799e2a0dfa6e..37e4a94cf2289632419c0c82805977e4031c3398 100644 (file)
@@ -168,6 +168,11 @@ symbol_table::insert_to_assembler_name_hash (symtab_node *node,
 
       tree name = DECL_ASSEMBLER_NAME (node->decl);
 
+      /* C++ FE can produce decls without associated assembler name and insert
+        them to symtab to hold section or TLS information.  */
+      if (!name)
+       return;
+
       hashval_t hash = decl_assembler_name_hash (name);
       aslot = assembler_name_hash->find_slot_with_hash (name, hash, INSERT);
       gcc_assert (*aslot != node);
@@ -209,6 +214,10 @@ symbol_table::unlink_from_assembler_name_hash (symtab_node *node,
        {
          tree name = DECL_ASSEMBLER_NAME (node->decl);
           symtab_node **slot;
+
+         if (!name)
+           return;
+
          hashval_t hash = decl_assembler_name_hash (name);
          slot = assembler_name_hash->find_slot_with_hash (name, hash,
                                                           NO_INSERT);
index bc4e0da32ec609bc86a51a6efe47094f70c9716c..959274724838ce9d1988a4e448ba8cd82b8db3d6 100644 (file)
@@ -1,4 +1,9 @@
-2014-12-14  Jan HUbicka  <hubicka@ucw.cz>
+2014-12-14  Jan Hubicka  <hubicka@ucw.cz>      
+       
+       PR ipa/61558
+       * g++.dg/torture/pr61558.C: New testcase.
+
+2014-12-14  Jan Hubicka  <hubicka@ucw.cz>
 
        PR lto/64043
        * g++.dg/lto/pr64043_0.C: New testcase.
diff --git a/gcc/testsuite/g++.dg/torture/pr61558.C b/gcc/testsuite/g++.dg/torture/pr61558.C
new file mode 100644 (file)
index 0000000..1e398e9
--- /dev/null
@@ -0,0 +1,6 @@
+// { dg-do compile }
+static __typeof 0 a __attribute__ ((__weakref__ ("")));
+template <typename> class A
+{
+  static __thread int b;
+};