https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119370
Bug ID: 119370
Summary: [15 Regression][OpenMP] ICE in gimple_add_tmp_var, at
gimplify.cc:834 for omptest's xt-declare-target-ctors
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code, openmp
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Target Milestone: ---
This is a GCC 15 regression, at least GCC 15 seems to work.
g++ -fopenmp -Wall xt-declare-target-ctors/test.cpp
xt-declare-target-ctors/test.cpp: In function ‘void
__omp_target_static_init_and_destruction_0()’:
xt-declare-target-ctors/test.cpp:103:9: internal compiler error: in
gimple_add_tmp_var, at gimplify.cc:834
103 | SSD sd[3];
| ^
The testcase is from omptest, which is available at:
*
https://github.com/doru1004/omptests/blob/main/xt-declare-target-ctors/test.cpp
* attachment 60500 "testcase (not preprocessed though)"
The attachment is for PR 118876 that fixed an ICE related to that test (in
cp/decl.cc's register_dtor_fn), but unfortunately only to the reduced testcase.
The full testcase still gives an ICE, albeit a different/later one one:
xt-declare-target-ctors/test.cpp: In function ‘void
__omp_target_static_init_and_destruction_0()’:
xt-declare-target-ctors/test.cpp:103:9: internal compiler error: in
gimple_add_tmp_var, at gimplify.cc:834
103 | SSD sd[3];
| ^
0x2951ddf internal_error(char const*, ...)
/home/tob/repos/gcc/gcc/diagnostic-global-context.cc:517
0xabe22d fancy_abort(char const*, int, char const*)
/home/tob/repos/gcc/gcc/diagnostic.cc:1722
0x8f6d7e gimple_add_tmp_var(tree_node*)
/home/tob/repos/gcc/gcc/gimplify.cc:834
0x1101281 gimplify_target_expr
/home/tob/repos/gcc/gcc/gimplify.cc:8185
0x10f323a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/tob/repos/gcc/gcc/gimplify.cc:19713
0x10f4466 gimplify_stmt(tree_node**, gimple**)
/home/tob/repos/gcc/gcc/gimplify.cc:8278
0x10f294b gimplify_statement_list
/home/tob/repos/gcc/gcc/gimplify.cc:2285
0x10f294b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/tob/repos/gcc/gcc/gimplify.cc:19761
0x10f333b gimplify_cleanup_point_expr
/home/tob/repos/gcc/gcc/gimplify.cc:8278
* * *
The failing assert is:
832 gimple_add_tmp_var (tree tmp)
833 {
834 gcc_assert (!DECL_CHAIN (tmp) && !DECL_SEEN_IN_BIND_EXPR_P (tmp));
<var_decl 0x7ffff71335f0 D.5728
type <integer_type 0x7ffff7228738 long int public DI
That's for
#2 0x0000000001101282 in gimplify_target_expr (...) gimplify.cc:8185
8185 gimple_add_tmp_var (temp);
(gdb) p debug(*expr_p)
TARGET_EXPR <D.5728, 2>