OSDN Git Service

2011-03-01 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 1 Mar 2011 09:46:19 +0000 (09:46 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 1 Mar 2011 09:46:19 +0000 (09:46 +0000)
PR lto/47924
* lto-streamer.c (lto_record_common_node): Also register
the canonical type.

* gcc.dg/lto/pr47924_0.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170589 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/lto-streamer.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/lto/pr47924_0.c [new file with mode: 0644]

index 5d567fb..79487c1 100644 (file)
@@ -1,5 +1,11 @@
 2011-03-01  Richard Guenther  <rguenther@suse.de>
 
+       PR lto/47924
+       * lto-streamer.c (lto_record_common_node): Also register
+       the canonical type.
+
+2011-03-01  Richard Guenther  <rguenther@suse.de>
+
        PR lto/46911
        * lto-streamer-in.c (lto_input_ts_decl_common_tree_pointers):
        Do not stream DECL_ABSTRACT_ORIGIN.
index dba9d2d..67132ef 100644 (file)
@@ -527,7 +527,9 @@ lto_record_common_node (tree *nodep, VEC(tree, heap) **common_nodes,
         are set by the middle-end.  */
       if (in_lto_p)
        TYPE_CANONICAL (node) = NULL_TREE;
-      *nodep = node = gimple_register_type (node);
+      node = gimple_register_type (node);
+      TYPE_CANONICAL (node) = gimple_register_canonical_type (node);
+      *nodep = node;
     }
 
   /* Return if node is already seen.  */
index 65e0db4..d5e79f8 100644 (file)
@@ -1,5 +1,10 @@
 2011-03-01  Richard Guenther  <rguenther@suse.de>
 
+       PR lto/47924
+       * gcc.dg/lto/pr47924_0.c: New testcase.
+
+2011-03-01  Richard Guenther  <rguenther@suse.de>
+
        PR lto/46911
        * gfortran.dg/lto/pr46911_0.f: New testcase.
 
diff --git a/gcc/testsuite/gcc.dg/lto/pr47924_0.c b/gcc/testsuite/gcc.dg/lto/pr47924_0.c
new file mode 100644 (file)
index 0000000..f7fdb44
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-O2 -flto}} } */
+
+extern void link_error (void);
+short *p __attribute__((used));
+int i __attribute__((used));
+
+int main()
+{
+  if (i == 0)
+    return;
+
+  *p = 0;
+
+  if (i == 0)
+    link_error ();
+
+  return 0;
+}