alias.c (compare_base_decls): Use symtab_node::get.
authorNathan Sidwell <nathan@acm.org>
Tue, 5 Jan 2016 14:15:01 +0000 (14:15 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Tue, 5 Jan 2016 14:15:01 +0000 (14:15 +0000)
gcc/
* alias.c (compare_base_decls): Use symtab_node::get.

gcc/testsuite/
* gcc.dg/alias-15.c: New.

From-SVN: r232073

gcc/ChangeLog
gcc/alias.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/alias-15.c [new file with mode: 0644]

index 83274e261a4f9a3f42d9109a9c66187f661bcccf..ff297bca9e3f725f09574e0a9f82bbdcdf763a4a 100644 (file)
@@ -1,3 +1,7 @@
+2016-01-05  Nathan Sidwell  <nathan@acm.org>
+
+       * alias.c (compare_base_decls): Use symtab_node::get.
+
 2016-01-05  Nick Clifton  <nickc@redhat.com>
 
        PR target/68770
index f59373626933a9ba83b5ca626814de04820b1d9b..e276d71f0461ecf135469fe9125746df584e9775 100644 (file)
@@ -2044,8 +2044,15 @@ compare_base_decls (tree base1, tree base2)
       || !decl_in_symtab_p (base2))
     return 0;
 
-  ret = symtab_node::get_create (base1)->equal_address_to
-                (symtab_node::get_create (base2), true);
+  /* Don't cause symbols to be inserted by the act of checking.  */
+  symtab_node *node1 = symtab_node::get (base1);
+  if (!node1)
+    return 0;
+  symtab_node *node2 = symtab_node::get (base2);
+  if (!node2)
+    return 0;
+  
+  ret = node1->equal_address_to (node2, true);
   if (ret == 2)
     return -1;
   return ret;
index 1bc843dccd11e99603e03c0c2a3e90f5634676cf..2298e084104b96036e0bed9ecd588936061e179a 100644 (file)
@@ -1,3 +1,7 @@
+2016-01-05  Nathan Sidwell  <nathan@acm.org>
+
+       * gcc.dg/alias-15.c: New.
+
 2016-01-05  Nick Clifton  <nickc@redhat.com>
 
        PR target/68870
diff --git a/gcc/testsuite/gcc.dg/alias-15.c b/gcc/testsuite/gcc.dg/alias-15.c
new file mode 100644 (file)
index 0000000..0a8e69b
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-additional-options  "-O2 -fdump-ipa-cgraph" } */
+
+/* RTL-level CSE shouldn't introduce LCO (for the string) into varpool */
+char *p;
+
+void foo ()
+{
+  p = "abc\n";
+
+  while (*p != '\n')
+    p++;
+}
+
+/* { dg-final { scan-ipa-dump-not "LC0" "cgraph" } } */