public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-10672] ipa/106124 - ICE with -fkeep-inline-functions and OpenMP Date: Tue, 2 May 2023 12:03:32 +0000 (GMT) [thread overview] Message-ID: <20230502120332.5A83E3856974@sourceware.org> (raw) https://gcc.gnu.org/g:1cfc7f22eb4587029624050006c2ab4e82e9a0b1 commit r11-10672-g1cfc7f22eb4587029624050006c2ab4e82e9a0b1 Author: Richard Biener <rguenther@suse.de> Date: Mon Mar 27 16:40:15 2023 +0200 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.c (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. (cherry picked from commit 36330e2e95564a360e6dbcfb4e7566d5c2177415) Diff: --- gcc/dwarf2out.c | 1 + gcc/testsuite/g++.dg/gomp/pr106124.C | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index e5d3ce4966d..c3dab15026d 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -5791,6 +5791,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 00000000000..3129749804b --- /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); +}
reply other threads:[~2023-05-02 12:03 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230502120332.5A83E3856974@sourceware.org \ --to=rguenth@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).