From d1e2e50a5f4d077eab6d3c93047203d15f16b324 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sun, 1 Sep 2019 13:56:13 +0200 Subject: [PATCH] =?utf8?q?re=20PR=20lto/91572=20(lto1:=20error:=20type=20v?= =?utf8?q?ariant=20has=20different=20=E2=80=98TREE=5FTYPE=E2=80=99=20since?= =?utf8?q?=20r269862)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/lto/pr91572_0.C | 12 ++++++++++++ gcc/tree.c | 7 +++++++ 4 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/g++.dg/lto/pr91572_0.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 25993147eab..d684c76d896 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-09-01 Jakub Jelinek + + 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 * doc/generic.texi (Unary and Binary Expressions): Mark up diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c590b46f65f..acb729d5fc7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-01 Jakub Jelinek + + PR lto/91572 + * g++.dg/lto/pr91572_0.C: New test. + 2019-08-30 Steven G. Kargl 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 index 00000000000..95a7e9fabf5 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr91572_0.C @@ -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)); } +} diff --git a/gcc/tree.c b/gcc/tree.c index 613efa5f2b0..afd70203c2b 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -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); } } } -- 2.30.2