From 48c82310947355665d628d4d1c8e736df9987574 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 20 Apr 2020 15:25:50 +0200 Subject: [PATCH] Fix ICE on invalid calls_comdat_local flag [pr94582] PR ipa/94582 * tree-inline.c (optimize_inline_calls): Recompute calls_comdat_local flag. * g++.dg/torture/pr94582.C: New test. --- gcc/ChangeLog | 6 ++ gcc/ipa-comdats.c | 9 +++ gcc/testsuite/ChangeLog | 6 ++ gcc/testsuite/g++.dg/torture/pr94582.C | 87 ++++++++++++++++++++++++++ gcc/tree-inline.c | 1 + 5 files changed, 109 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/pr94582.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 405037efbed..cc6c6389b90 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2020-04-20 Jan Hubicka + + PR ipa/94582 + * tree-inline.c (optimize_inline_calls): Recompute calls_comdat_local + flag. + 2020-04-20 Martin Liska * symtab.c (symtab_node::dump_references): Add space after diff --git a/gcc/ipa-comdats.c b/gcc/ipa-comdats.c index ced25723bf8..feea458ca3f 100644 --- a/gcc/ipa-comdats.c +++ b/gcc/ipa-comdats.c @@ -376,6 +376,15 @@ ipa_comdats (void) true); } } + +#if 0 + /* Recompute calls comdat local flag. This need to be done after all changes + are made. */ + cgraph_node *function; + FOR_EACH_DEFINED_FUNCTION (function) + if (function->get_comdat_group ()) + function->calls_comdat_local = function->check_calls_comdat_local_p (); +#endif return 0; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 473295dbef3..9ba21a0b7f8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-04-20 Jan Hubicka + + PR ipa/94582 + PR ipa/94582 + * g++.dg/torture/pr94582.C: New test. + 2020-04-20 Harald Anlauf PR fortran/93364 diff --git a/gcc/testsuite/g++.dg/torture/pr94582.C b/gcc/testsuite/g++.dg/torture/pr94582.C new file mode 100644 index 00000000000..b06285a196c --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr94582.C @@ -0,0 +1,87 @@ +// { dg-do compile } +// { dg-additional-options "-fnon-call-exceptions -fno-inline-functions-called-once -fno-tree-sra --param early-inlining-insns=1" } +template struct __replace_first_arg; +template