public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected
@ 2023-01-16 17:49 gscfq@t-online.de
2023-01-17 7:04 ` [Bug c++/108422] " rguenth at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: gscfq@t-online.de @ 2023-01-16 17:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422
Bug ID: 108422
Summary: [13 Regression] ICE: base pointer cycle detected
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gscfq@t-online.de
Target Milestone: ---
Started between 20220911 and 20220918 :
$ cat z1.cc
void foo (int a)
{
auto bar = [&]()
{
#pragma omp target parallel
#pragma omp target
++a;
};
bar();
}
$ cat z2.cc
void foo (int a)
{
auto bar = [&]()
{
#pragma omp target
#pragma omp target
++a;
};
bar();
}
$ g++-13-20230115 -c z1.cc -fopenmp
when processing group:
map(to:*__closure)
z1.cc: In lambda function:
z1.cc:5:13: internal compiler error: base pointer cycle detected
5 | #pragma omp target parallel
| ^~~
0xc0a6f3 omp_tsort_mapping_groups_1
../../gcc/gimplify.cc:9603
0xc0a515 omp_tsort_mapping_groups_1
../../gcc/gimplify.cc:9646
0xc0a515 omp_tsort_mapping_groups_1
../../gcc/gimplify.cc:9646
0xc1ee00 omp_tsort_mapping_groups
../../gcc/gimplify.cc:9684
0xc1ee00 gimplify_scan_omp_clauses
../../gcc/gimplify.cc:10771
0xc24fce gimplify_omp_workshare
../../gcc/gimplify.cc:15390
0xc10cca gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gimplify.cc:16903
0xc14308 gimplify_stmt(tree_node**, gimple**)
../../gcc/gimplify.cc:7219
0xc14861 gimplify_bind_expr
../../gcc/gimplify.cc:1430
0xc10eea gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gimplify.cc:16562
0xc14308 gimplify_stmt(tree_node**, gimple**)
../../gcc/gimplify.cc:7219
0xc11ccb gimplify_statement_list
../../gcc/gimplify.cc:2019
0xc11ccb gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gimplify.cc:16806
0xc14308 gimplify_stmt(tree_node**, gimple**)
../../gcc/gimplify.cc:7219
0xc14861 gimplify_bind_expr
../../gcc/gimplify.cc:1430
0xc10eea gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gimplify.cc:16562
0xc14308 gimplify_stmt(tree_node**, gimple**)
../../gcc/gimplify.cc:7219
0xc153ab gimplify_body(tree_node*, bool)
../../gcc/gimplify.cc:17623
0xc157fd gimplify_function_tree(tree_node*)
../../gcc/gimplify.cc:17822
0xa988e7 cgraph_node::analyze()
../../gcc/cgraphunit.cc:676
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/108422] [13 Regression] ICE: base pointer cycle detected
2023-01-16 17:49 [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected gscfq@t-online.de
@ 2023-01-17 7:04 ` rguenth at gcc dot gnu.org
2023-01-17 13:29 ` [Bug c++/108422] [13 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7 marxin at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-17 7:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Target Milestone|--- |13.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/108422] [13 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7
2023-01-16 17:49 [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected gscfq@t-online.de
2023-01-17 7:04 ` [Bug c++/108422] " rguenth at gcc dot gnu.org
@ 2023-01-17 13:29 ` marxin at gcc dot gnu.org
2023-02-20 9:26 ` burnus at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-17 13:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[13 Regression] ICE: base |[13 Regression] ICE: base
|pointer cycle detected |pointer cycle detected
| |since
| |r13-2661-gb57abd072dd319a7
Last reconfirmed| |2023-01-17
Ever confirmed|0 |1
CC| |julian at codesourcery dot com,
| |marxin at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r13-2661-gb57abd072dd319a7.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/108422] [13 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7
2023-01-16 17:49 [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected gscfq@t-online.de
2023-01-17 7:04 ` [Bug c++/108422] " rguenth at gcc dot gnu.org
2023-01-17 13:29 ` [Bug c++/108422] [13 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7 marxin at gcc dot gnu.org
@ 2023-02-20 9:26 ` burnus at gcc dot gnu.org
2023-02-20 9:45 ` burnus at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-02-20 9:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu.org
Keywords| |ice-on-invalid-code
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
#pragma omp target parallel
#pragma omp target
++a;
This violates:
"Restrictions to the target construct are as follows:
• Device-affecting constructs, other than target constructs for which the
ancestor device-modifier is specified, must not be encountered during execution
of a target region."
And GCC should print (existing check):
warning: ‘target’ construct inside of ‘target’ region
However, when making it valid by adding
#pragma omp requires reverse_offload
+ adding 'device(ancestor:1)' to the second 'omp target',
it still fails with the ICE.
* * *
For the failing case,
Breakpoint 4, gimplify_scan_omp_clauses (list_p=0x7ffff6fc5570,
pre_p=0x7fffffffd7a0, region_type=ORT_TARGET, code=OMP_TARGET) at
../../repos/gcc/gcc/gimplify.cc:10771
10771 outlist = omp_tsort_mapping_groups (groups, grpmap);
(gdb) p debug(groups->m_vec->m_vecdata.grp_start[0])
map(to:*(const struct ._anon_0 *) __closure)
map(firstprivate:__closure [pointer assign, bias: 0])
map(tofrom:*__closure->__a [len: 4])
map(always_pointer:__closure->__a [pointer assign, bias: 0])
map(to:*__closure)
map(to:*(const struct ._anon_0 *) __closure)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/108422] [13 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7
2023-01-16 17:49 [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected gscfq@t-online.de
` (2 preceding siblings ...)
2023-02-20 9:26 ` burnus at gcc dot gnu.org
@ 2023-02-20 9:45 ` burnus at gcc dot gnu.org
2023-02-20 10:02 ` burnus at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-02-20 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FOR_EACH_VEC_ELT (*groups, i, grp)
{
if (grp->mark != PERMANENT)
if (!omp_tsort_mapping_groups_1 (&cursor, groups, grpmap, grp))
return NULL;
}
first processes:
map(to:*(const struct ._anon_0 *) __closure) map(firstprivate:__closure
[pointer assign, bias: 0]) map(tofrom:*__closure->__a [len: 4])
map(always_pointer:__closure->__a [pointer assign, bias: 0]) map(to:*__closure)
map(to:*(const struct ._anon_0 *) __closure)
which then has:
*innerp == grp
in omp_tsort_mapping_groups_1.
The next VEC has:
(gdb) p debug(*grp.grp_start)
map(tofrom:*__closure->__a [len: 4]) map(always_pointer:__closure->__a [pointer
assign, bias: 0]) map(to:*__closure) map(to:*(const struct ._anon_0 *)
__closure)
But the inner one is again the previous one:
(gdb) p debug(**innerp.grp_start)
map(to:*(const struct ._anon_0 *) __closure) map(firstprivate:__closure
[pointer assign, bias: 0]) map(tofrom:*__closure->__a [len: 4])
map(always_pointer:__closure->__a [pointer assign, bias: 0]) map(to:*__closure)
map(to:*(const struct ._anon_0 *) __closure)
where:
(gdb) p (*innerp)->mark
$78 = PERMANENT
Untested patch:
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -9643 +9643 @@ omp_tsort_mapping_groups_1 (omp_mapping_group ***outlist,
- if (innerp && *innerp != grp)
+ if (innerp && *innerp != grp && (*innerp)->mark != PERMANENT)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/108422] [13 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7
2023-01-16 17:49 [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected gscfq@t-online.de
` (3 preceding siblings ...)
2023-02-20 9:45 ` burnus at gcc dot gnu.org
@ 2023-02-20 10:02 ` burnus at gcc dot gnu.org
2023-02-21 13:05 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-02-20 10:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422
--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 54491
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54491&action=edit
Testcase - compile with 'g++ -fopenmp' + run
(In reply to Tobias Burnus from comment #3)
> --- a/gcc/gimplify.cc
> +++ b/gcc/gimplify.cc
> @@ -9643 +9643 @@ omp_tsort_mapping_groups_1 (omp_mapping_group ***outlist,
> - if (innerp && *innerp != grp)
> + if (innerp && *innerp != grp && (*innerp)->mark != PERMANENT)
While COMPILING WORKS and the expected nested-target warning is printed,
it FAILS at RUNTIME (on a system not configured for offloading) with a
segfault.
That's related to the warning:
test.cc:20:13: warning: '__closure' is used uninitialized [-Wuninitialized]
which appears at the location of the outer 'omp target (parallel)'.
Note: without inner target construct (reverse offload), the program runs fine.
(Independent of the one-line patch.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/108422] [13 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7
2023-01-16 17:49 [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected gscfq@t-online.de
` (4 preceding siblings ...)
2023-02-20 10:02 ` burnus at gcc dot gnu.org
@ 2023-02-21 13:05 ` rguenth at gcc dot gnu.org
2023-02-21 17:43 ` burnus at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-21 13:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Priority|P3 |P1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/108422] [13 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7
2023-01-16 17:49 [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected gscfq@t-online.de
` (5 preceding siblings ...)
2023-02-21 13:05 ` rguenth at gcc dot gnu.org
@ 2023-02-21 17:43 ` burnus at gcc dot gnu.org
2023-04-26 6:57 ` [Bug c++/108422] [13/14 " rguenth at gcc dot gnu.org
2023-07-27 9:25 ` rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-02-21 17:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P1 |P3
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
As discussed with richi on #gcc IRC: it shouldn't be P1 - and I could/should
mark it as P3, which I now did.
Reasoning:
- With GCC 12, it compiles without an ICE but as with mainline with the patch
in
comment 4 applied, it will fail (segfault) at runtime
(→ testcase in attachment 54491)
- If being strict, nested target is not permitted - except with
'reverse offload', which fails in GCC 12 (sorry) as not supported.
(Still, we should try to fix the ICE - but best instead of creating invalid
code,
either a sorry or working code would be good.)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/108422] [13/14 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7
2023-01-16 17:49 [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected gscfq@t-online.de
` (6 preceding siblings ...)
2023-02-21 17:43 ` burnus at gcc dot gnu.org
@ 2023-04-26 6:57 ` rguenth at gcc dot gnu.org
2023-07-27 9:25 ` rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-26 6:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|13.0 |13.2
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.1 is being released, retargeting bugs to GCC 13.2.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/108422] [13/14 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7
2023-01-16 17:49 [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected gscfq@t-online.de
` (7 preceding siblings ...)
2023-04-26 6:57 ` [Bug c++/108422] [13/14 " rguenth at gcc dot gnu.org
@ 2023-07-27 9:25 ` rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27 9:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108422
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|13.2 |13.3
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-07-27 9:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16 17:49 [Bug c++/108422] New: [13 Regression] ICE: base pointer cycle detected gscfq@t-online.de
2023-01-17 7:04 ` [Bug c++/108422] " rguenth at gcc dot gnu.org
2023-01-17 13:29 ` [Bug c++/108422] [13 Regression] ICE: base pointer cycle detected since r13-2661-gb57abd072dd319a7 marxin at gcc dot gnu.org
2023-02-20 9:26 ` burnus at gcc dot gnu.org
2023-02-20 9:45 ` burnus at gcc dot gnu.org
2023-02-20 10:02 ` burnus at gcc dot gnu.org
2023-02-21 13:05 ` rguenth at gcc dot gnu.org
2023-02-21 17:43 ` burnus at gcc dot gnu.org
2023-04-26 6:57 ` [Bug c++/108422] [13/14 " rguenth at gcc dot gnu.org
2023-07-27 9:25 ` rguenth at gcc dot gnu.org
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).