* Re: [PATCH] ipa/106124 - ICE with -fkeep-inline-functions and OpenMP
[not found] <20230328062050.EC5563858408@sourceware.org>
@ 2023-04-02 19:43 ` Jeff Law
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Law @ 2023-04-02 19:43 UTC (permalink / raw)
To: Richard Biener, gcc-patches; +Cc: jason, Jakub Jelinek
On 3/28/23 00:20, Richard Biener via Gcc-patches wrote:
> 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.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
>
> OK?
>
> Thanks,
> Richard.
>
> 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.
OK
jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ipa/106124 - ICE with -fkeep-inline-functions and OpenMP
[not found] <20230328062041.B49C13858D39@sourceware.org>
@ 2023-03-28 14:59 ` Jakub Jelinek
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2023-03-28 14:59 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches, jason
On Tue, Mar 28, 2023 at 06:20:36AM +0000, Richard Biener via Gcc-patches wrote:
> 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.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu.
>
> OK?
>
> Thanks,
> Richard.
>
> 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.
Ok, though I'm afraid it doesn't solve all the UDR lambda/nested fn
related issues.
> diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
> index 1711ad2c2da..1a0015ce00f 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 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);
> +}
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] ipa/106124 - ICE with -fkeep-inline-functions and OpenMP
@ 2023-03-28 6:20 Richard Biener
0 siblings, 0 replies; 3+ messages in thread
From: Richard Biener @ 2023-03-28 6:20 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, Jakub Jelinek
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.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
OK?
Thanks,
Richard.
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.
---
gcc/dwarf2out.cc | 1 +
gcc/testsuite/g++.dg/gomp/pr106124.C | 19 +++++++++++++++++++
2 files changed, 20 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/gomp/pr106124.C
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 1711ad2c2da..1a0015ce00f 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 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);
+}
--
2.35.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-02 19:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20230328062050.EC5563858408@sourceware.org>
2023-04-02 19:43 ` [PATCH] ipa/106124 - ICE with -fkeep-inline-functions and OpenMP Jeff Law
[not found] <20230328062041.B49C13858D39@sourceware.org>
2023-03-28 14:59 ` Jakub Jelinek
2023-03-28 6:20 Richard Biener
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).