]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR lto/91572 (lto1: error: type variant has different ‘TREE_TYPE’ since...
authorJakub Jelinek <jakub@redhat.com>
Mon, 21 Oct 2019 11:37:41 +0000 (13:37 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 21 Oct 2019 11:37:41 +0000 (13:37 +0200)
Backported from mainline
2019-09-01  Jakub Jelinek  <jakub@redhat.com>

PR lto/91572
* tree.c (find_decls_types_in_node): Also walk TREE_PURPOSE of
GIMPLE_ASM TREE_LIST operands.

* g++.dg/lto/pr91572_0.C: New test.

From-SVN: r277245

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/pr91572_0.C [new file with mode: 0644]
gcc/tree.c

index 7242fd804a16dcdfad76ba0d1f9c86d732a9834e..3316996183b9aa12d80d3e1953420f034271c058 100644 (file)
        * match.pd (X / C1 op C2): Don't call unsigned_type_for on
        range_check_type result.
 
+       2019-09-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR lto/91572
+       * tree.c (find_decls_types_in_node): Also walk TREE_PURPOSE of
+       GIMPLE_ASM TREE_LIST operands.
+
        2019-08-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/91351
index 6b55e4372313ea8bdb91908f5a6ff1f4c4b87846..57e95b2b1aa13c5afc7081c94d3acd58b645cfcb 100644 (file)
@@ -1,6 +1,11 @@
 2019-10-21  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-09-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR lto/91572
+       * g++.dg/lto/pr91572_0.C: New test.
+
        2019-08-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/91351
diff --git a/gcc/testsuite/g++.dg/lto/pr91572_0.C b/gcc/testsuite/g++.dg/lto/pr91572_0.C
new file mode 100644 (file)
index 0000000..95a7e9f
--- /dev/null
@@ -0,0 +1,12 @@
+// PR lto/91572
+// { dg-lto-do link }
+// { dg-lto-options { { -O -fPIC -flto } } }
+// { dg-require-effective-target shared }
+// { dg-require-effective-target fpic }
+// { dg-extra-ld-options "-shared" }
+
+void foo (char);
+namespace N {
+  class A { A (); };
+  A::A () { asm ("" : : "g" (0)); }
+}
index 36ccdae3793504bcc0014a1f96dfaa03e938efa5..b20781ce00b0c157e4a64d60e7165e31cc8f3db1 100644 (file)
@@ -6107,6 +6107,13 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld)
            {
              tree arg = gimple_op (stmt, i);
              find_decls_types (arg, fld);
+             /* find_decls_types doesn't walk TREE_PURPOSE of TREE_LISTs,
+                which we need for asm stmts.  */
+             if (arg
+                 && TREE_CODE (arg) == TREE_LIST
+                 && TREE_PURPOSE (arg)
+                 && gimple_code (stmt) == GIMPLE_ASM)
+               find_decls_types (TREE_PURPOSE (arg), fld);
            }
        }
     }