From: Jakub Jelinek Date: Sun, 1 Sep 2019 11:56:13 +0000 (+0200) Subject: re PR lto/91572 (lto1: error: type variant has different ‘TREE_TYPE’ since r269862) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d1e2e50a5f4d077eab6d3c93047203d15f16b324;p=gcc.git re PR lto/91572 (lto1: error: type variant has different ‘TREE_TYPE’ since r269862) 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 --- 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); } } }