diff options
author | Richard Biener <rguenther@suse.de> | 2023-03-27 16:40:15 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-03-29 08:55:34 +0200 |
commit | 36330e2e95564a360e6dbcfb4e7566d5c2177415 (patch) | |
tree | 16ab86a32bcbaf57fecd3210554bfdf3e8577fef | |
parent | 8dd57939c20b5e218404a838f514429f8e414dea (diff) | |
download | gcc-36330e2e95564a360e6dbcfb4e7566d5c2177415.zip gcc-36330e2e95564a360e6dbcfb4e7566d5c2177415.tar.gz gcc-36330e2e95564a360e6dbcfb4e7566d5c2177415.tar.bz2 |
ipa/106124 - ICE with -fkeep-inline-functions and OpenMP
The testcases in this bug reveal cases where an early generated
type is collected because it was unused but gets attempted to
be recreated later when a late DIE for a function (an OpenMP
reduction) is created. That's unexpected and possibly the fault
of OpenMP but the following allows the re-creation of the context
type to succeed.
PR ipa/106124
* dwarf2out.cc (lookup_type_die): Reset TREE_ASM_WRITTEN
so we can re-create the DIE for the type if required.
* g++.dg/gomp/pr106124.C: New testcase.
-rw-r--r-- | gcc/dwarf2out.cc | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/gomp/pr106124.C | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 1711ad2..1a0015c 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -5894,6 +5894,7 @@ lookup_type_die (tree type) if (die && die->removed) { TYPE_SYMTAB_DIE (type) = NULL; + TREE_ASM_WRITTEN (type) = 0; return NULL; } return die; diff --git a/gcc/testsuite/g++.dg/gomp/pr106124.C b/gcc/testsuite/g++.dg/gomp/pr106124.C new file mode 100644 index 0000000..3129749 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr106124.C @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-require-effective-target c++11 } +// { dg-options "-g -O2 -fopenmp -fkeep-inline-functions" } + +int q; +struct A +{ + typedef int T; +#pragma omp declare reduction (x : T : omp_out += omp_in + [] (){ return q; }()) initializer (omp_priv = [](){ return 0; }()) + static void foo (); +}; +void bar (int &, int &); +void +A::foo () +{ + int r = 0, s = 0; +#pragma omp parallel reduction (x : r, s) + bar (r, s); +} |