re PR lto/91572 (lto1: error: type variant has different ‘TREE_TYPE’ since r269862)
authorJakub Jelinek <jakub@redhat.com>
Sun, 1 Sep 2019 11:56:13 +0000 (13:56 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 1 Sep 2019 11:56:13 +0000 (13:56 +0200)
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: r275266

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

index 25993147eabc6910bc77aa84a9e32bed34b9896f..d684c76d89630991b70ef15a16ca98cd60fc0251 100644 (file)
@@ -1,3 +1,9 @@
+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-31  Gerald Pfeifer  <gerald@pfeifer.com>
 
        * doc/generic.texi (Unary and Binary Expressions): Mark up
index c590b46f65f4c8d35d227c3e81f70c86d8a5d612..acb729d5fc75691c1b1cc2f82f11cd8cfa5ceb37 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR lto/91572
+       * g++.dg/lto/pr91572_0.C: New test.
+
 2019-08-30  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/91587
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 613efa5f2b0412e6d272aea7b30e165cce4556d3..afd70203c2b5f673c94dcf45d17af0c50a3cb2c9 100644 (file)
@@ -6142,6 +6142,13 @@ find_decls_types_in_node (struct cgraph_node *n, class 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);
            }
        }
     }