* [Bug ipa/106124] [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
@ 2022-06-28 18:45 ` marxin at gcc dot gnu.org
2022-06-29 9:45 ` rguenth at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-06-28 18:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-5053-gb3f44388f3bb9b42, but it ICEd with a different reason
the revision before it:
/home/marxin/Programming/gcc/libgomp/testsuite/libgomp.c++/udr-20.C:16:134:
internal compiler error: in cp_check_omp_declare_reduction, at
cp/semantics.c:5482
#pragma omp declare reduction (x : T : omp_out += omp_in + [](){ return T
(0); }()) initializer (omp_priv = [](){ return T (0); }())
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ipa/106124] [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
2022-06-28 18:45 ` [Bug ipa/106124] " marxin at gcc dot gnu.org
@ 2022-06-29 9:45 ` rguenth at gcc dot gnu.org
2022-06-29 11:23 ` jakub at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-29 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ipa/106124] [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
2022-06-28 18:45 ` [Bug ipa/106124] " marxin at gcc dot gnu.org
2022-06-29 9:45 ` rguenth at gcc dot gnu.org
@ 2022-06-29 11:23 ` jakub at gcc dot gnu.org
2023-03-27 14:37 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-29 11:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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);
}
ICEs too with the same options, but in a different spot.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ipa/106124] [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
` (2 preceding siblings ...)
2022-06-29 11:23 ` jakub at gcc dot gnu.org
@ 2023-03-27 14:37 ` rguenth at gcc dot gnu.org
2023-03-28 14:58 ` jakub at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-27 14:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Last reconfirmed| |2023-03-27
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
We have
(gdb) p debug_tree (type)
<record_type 0x7ffff64452a0 ._anon_1 asm_written cxx-odr-p type_5 QI
size <integer_cst 0x7ffff628b0c0 type <integer_type 0x7ffff62890a8
bitsizetype> constant 8>
...
with TREE_ASM_WRITTEN but not a DIE recorded. For this reason
gen_type_die_with_usage does nothing.
Earlier we created a DIE for the type but we pruned it as unused later via
#0 mark_removed (
die=<dw_die_ref 0x7ffff645c4b0 DW_TAG_structure_type <parent=0x7ffff6296000
DW_TAG_compile_unit>>) at /home/rguenther/src/trunk/gcc/dwarf2out.cc:30245
#1 0x00000000013c291a in prune_unused_types_prune (
die=<dw_die_ref 0x7ffff6296000 DW_TAG_compile_unit>)
at /home/rguenther/src/trunk/gcc/dwarf2out.cc:30278
#2 0x00000000013c2c21 in prune_unused_types ()
at /home/rguenther/src/trunk/gcc/dwarf2out.cc:30363
#3 0x00000000013c8cdb in dwarf2out_early_finish (filename=0x45b83a0 "t.ii")
at /home/rguenther/src/trunk/gcc/dwarf2out.cc:32997
we can possibly "fix" that failure to re-create the DIE late by making
sure to also clear TREE_ASM_WRITTEN on it.
Of course the question is why we have no early DIE for the function
<function_decl 0x7ffff6444b00 _FUN
type <function_type 0x7ffff629e0a8
...
full-name "static constexpr int A::omp declare reduction
x~i(T&)::<lambda()>::_FUN()"
I suppose that's the OMP reduction function and that's always(?) inlined?
The following fixes the ICE, but as said I wonder why nothing creates a
DIE for the function early?
I'm going to test this and propose it still.
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;
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ipa/106124] [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
` (3 preceding siblings ...)
2023-03-27 14:37 ` rguenth at gcc dot gnu.org
@ 2023-03-28 14:58 ` jakub at gcc dot gnu.org
2023-03-29 6:46 ` rguenther at suse dot de
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-28 14:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> I suppose that's the OMP reduction function and that's always(?) inlined?
The reduction "function" is something artificial which holds some expressions
for the
OpenMP reductions; we just need to attach those statements to some decl for
name lookup purposes.
The problem is what to do with lambdas defined inside of those expressions, or
e.g. nested functions for the C case:
int q;
#pragma omp declare reduction (x : int : omp_out += omp_in + ({ int a = 1; void
foo () { a++; } foo (); a; }))
void bar (int *, int *);
void
foo ()
{
int r = 0, s = 0;
#pragma omp parallel reduction (x : r, s)
bar (&r, &s);
}
ICEs too. Lambdas are there certainly valid, we try to pretend the artificial
functions don't really exist for the debug info purposes, but apparently not
sufficiently.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ipa/106124] [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
` (4 preceding siblings ...)
2023-03-28 14:58 ` jakub at gcc dot gnu.org
@ 2023-03-29 6:46 ` rguenther at suse dot de
2023-03-29 6:56 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenther at suse dot de @ 2023-03-29 6:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
--- Comment #5 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 28 Mar 2023, jakub at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
>
> --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> (In reply to Richard Biener from comment #3)
> > I suppose that's the OMP reduction function and that's always(?) inlined?
>
> The reduction "function" is something artificial which holds some expressions
> for the
> OpenMP reductions; we just need to attach those statements to some decl for
> name lookup purposes.
> The problem is what to do with lambdas defined inside of those expressions, or
> e.g. nested functions for the C case:
> int q;
>
> #pragma omp declare reduction (x : int : omp_out += omp_in + ({ int a = 1; void
> foo () { a++; } foo (); a; }))
>
> void bar (int *, int *);
>
> void
> foo ()
> {
> int r = 0, s = 0;
> #pragma omp parallel reduction (x : r, s)
> bar (&r, &s);
> }
>
> ICEs too. Lambdas are there certainly valid, we try to pretend the artificial
> functions don't really exist for the debug info purposes, but apparently not
> sufficiently.
Set DECL_IGNORED?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ipa/106124] [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
` (5 preceding siblings ...)
2023-03-29 6:46 ` rguenther at suse dot de
@ 2023-03-29 6:56 ` cvs-commit at gcc dot gnu.org
2023-03-29 6:57 ` [Bug ipa/106124] [11/12 " rguenth at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-29 6:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:36330e2e95564a360e6dbcfb4e7566d5c2177415
commit r13-6925-g36330e2e95564a360e6dbcfb4e7566d5c2177415
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.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.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ipa/106124] [11/12 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
` (6 preceding siblings ...)
2023-03-29 6:56 ` cvs-commit at gcc dot gnu.org
@ 2023-03-29 6:57 ` rguenth at gcc dot gnu.org
2023-04-17 9:14 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-29 6:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12/13 Regression] ICE |[11/12 Regression] ICE in
|in |dwarf2out_abstract_function
|dwarf2out_abstract_function |, at dwarf2out.cc:23254
|, at dwarf2out.cc:23254 |
Known to work| |13.0
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Worked around on trunk sofar.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ipa/106124] [11/12 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
` (7 preceding siblings ...)
2023-03-29 6:57 ` [Bug ipa/106124] [11/12 " rguenth at gcc dot gnu.org
@ 2023-04-17 9:14 ` cvs-commit at gcc dot gnu.org
2023-05-02 12:03 ` [Bug ipa/106124] [11 " cvs-commit at gcc dot gnu.org
2023-05-02 12:05 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-17 9:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:377efe66243a3ec9d44707e3526742aa3d924094
commit r12-9408-g377efe66243a3ec9d44707e3526742aa3d924094
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.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.
(cherry picked from commit 36330e2e95564a360e6dbcfb4e7566d5c2177415)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ipa/106124] [11 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
` (8 preceding siblings ...)
2023-04-17 9:14 ` cvs-commit at gcc dot gnu.org
@ 2023-05-02 12:03 ` cvs-commit at gcc dot gnu.org
2023-05-02 12:05 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-02 12:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
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)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug ipa/106124] [11 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254
2022-06-28 17:11 [Bug c++/106124] New: [11/12/13 Regression] ICE in dwarf2out_abstract_function, at dwarf2out.cc:23254 gscfq@t-online.de
` (9 preceding siblings ...)
2023-05-02 12:03 ` [Bug ipa/106124] [11 " cvs-commit at gcc dot gnu.org
@ 2023-05-02 12:05 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-02 12:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106124
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Known to work| |11.3.1
Status|ASSIGNED |RESOLVED
Known to fail| |11.3.0
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 12+ messages in thread