https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119119

            Bug ID: 119119
           Summary: ICE in create_tmp_var
           Product: gcc
           Version: 14.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jehelset at gmail dot com
  Target Milestone: ---

Reproduced on both gcc-14.2.1 and trunk (8d7762945bb).

Was compiling https://github.com/maikel/senders-io (main) with
https://github.com/NVIDIA/stdexec (nvhpc-25.03.rc1).
Works with -O0 fails with -O{1,2,3}.

Stacktrace:

during GIMPLE pass: einline
In file included from
/home/jeh/code/github/maikel/senders-io/source/sio/sequence/ignore_all.hpp:18,
                 from
/home/jeh/code/github/maikel/senders-io/tests/sequence/test_scan.cpp:17:
/usr/include/exec/sequence/ignore_all_values.hpp: In constructor
‘exec::__ignore_all_values::__operation<_Sender,
_ReceiverId>::__t::__t(_Sender&&,
exec::__ignore_all_values::__operation<_Sender, _ReceiverId>::_Receiver) [with
_Sender = exec::__seqexpr<<lambda closure
object>stdexec::{anonymous}::<lambda()>(), stdexec::{anonymous}::__anon>&;
_ReceiverId = stdexec::__sync_wait::__receiver<>]’:
/usr/include/exec/sequence/ignore_all_values.hpp:246:34: internal compiler
error: in create_tmp_var, at gimple-expr.cc:484
  246 |           , __op_{exec::subscribe(static_cast<_Sender&&>(__sndr),
__receiver_t{this})} {

#0  internal_error (gmsgid=0x4864337 "in %s, at %s:%d") at
../../gcc/diagnostic-global-context.cc:512
#1  0x0000000003bf1031 in fancy_abort (file=0x3f7bf8a
"../../gcc/gimple-expr.cc", line=484, function=0x3f7c016 "create_tmp_var") at
../../gcc/diagnostic.cc:1722
#2  0x00000000017b10c7 in create_tmp_var (type=0x7fffeee82000, prefix=0x0) at
../../gcc/gimple-expr.cc:484
#3  0x0000000001816ac3 in create_tmp_from_val (val=0x7fffe240e138) at
../../gcc/gimplify.cc:622
#4  0x0000000001816c5f in lookup_tmp_var (val=0x7fffe240e138, is_formal=true,
not_gimple_reg=false) at ../../gcc/gimplify.cc:660
#5  0x0000000001816eb6 in internal_get_tmp_var (val=0x7fffe240e138,
pre_p=0x7fffffffd0e0, post_p=0x0, is_formal=true, allow_ssa=true,
not_gimple_reg=false) at ../../gcc/gimplify.cc:699
#6  0x00000000018170f1 in get_formal_tmp_var (val=0x7fffe240e138,
pre_p=0x7fffffffd0e0) at ../../gcc/gimplify.cc:732
#7  0x000000000186d2a5 in gimplify_expr (expr_p=0x7fffffffd0e8,
pre_p=0x7fffffffd0e0, post_p=0x7fffffffced0, gimple_test_f=0x18169ac
<is_gimple_mem_rhs_or_call(tree)>, fallback=1)
    at ../../gcc/gimplify.cc:20387
#8  0x0000000001876fc0 in gimple_regimplify_operands (stmt=0x7fffe240b8f0,
gsi_p=0x7fffffffd330) at ../../gcc/gimplify-me.cc:235
#9  0x0000000001d9ef24 in copy_bb (id=0x7fffffffda50, bb=0x7ffff219c420,
num=..., den=...) at ../../gcc/tree-inline.cc:2122
#10 0x0000000001da25c5 in copy_cfg_body (id=0x7fffffffda50,
entry_block_map=0x7ffff217fae0, exit_block_map=0x7ffff2186180, new_entry=0x0)
at ../../gcc/tree-inline.cc:3114
#11 0x0000000001da3294 in copy_body (id=0x7fffffffda50,
entry_block_map=0x7ffff217fae0, exit_block_map=0x7ffff2186180, new_entry=0x0)
at ../../gcc/tree-inline.cc:3367
#12 0x0000000001da8b3e in expand_call_inline (bb=0x7ffff217fae0,
stmt=0x7ffff21666e0, id=0x7fffffffda50, to_purge=0x7fffffffda10) at
../../gcc/tree-inline.cc:5208
#13 0x0000000001da9a7c in gimple_expand_calls_inline (bb=0x7ffff217fae0,
id=0x7fffffffda50, to_purge=0x7fffffffda10) at ../../gcc/tree-inline.cc:5419
#14 0x0000000001daa539 in optimize_inline_calls (fn=0x7fffe609ac00) at
../../gcc/tree-inline.cc:5609
#15 0x00000000039c9e1d in early_inliner (fun=0x7fffe677c9c0) at
../../gcc/ipa-inline.cc:3161
#16 0x00000000039c9fee in (anonymous namespace)::pass_early_inline::execute
(this=0x503b830, fun=0x7fffe677c9c0) at ../../gcc/ipa-inline.cc:3233
#17 0x0000000001b50bdf in execute_one_pass (pass=0x503b830) at
../../gcc/passes.cc:2659
#18 0x0000000001b50fbe in execute_pass_list_1 (pass=0x503b830) at
../../gcc/passes.cc:2768
#19 0x0000000001b51048 in execute_pass_list (fn=0x7fffe677c9c0, pass=0x503b710)
at ../../gcc/passes.cc:2779
#20 0x0000000001b4ea0f in do_per_function_toporder (callback=0x1b5100b
<execute_pass_list(function*, opt_pass*)>, data=0x503b710) at
../../gcc/passes.cc:1786
#21 0x0000000001b51c92 in execute_ipa_pass_list (pass=0x503b6b0) at
../../gcc/passes.cc:3117
#22 0x000000000158b1b4 in ipa_passes () at ../../gcc/cgraphunit.cc:2228
#23 0x000000000158b53c in symbol_table::compile (this=0x7ffff7206000) at
../../gcc/cgraphunit.cc:2351
#24 0x000000000158bb30 in symbol_table::finalize_compilation_unit
(this=0x7ffff7206000) at ../../gcc/cgraphunit.cc:2603
#25 0x0000000001cdd98e in compile_file () at ../../gcc/toplev.cc:479
#26 0x0000000001ce0fad in do_compile () at ../../gcc/toplev.cc:2208
#27 0x0000000001ce1444 in toplev::main (this=0x7fffffffdf12, argc=44,
argv=0x7fffffffe058) at ../../gcc/toplev.cc:2371
#28 0x0000000003bb4dd5 in main (argc=44, argv=0x7fffffffe058) at
../../gcc/main.cc:39

`val` seems to be a mutex:

#3  0x0000000001816ac3 in create_tmp_from_val (val=0x7fffe240e138) at
../../gcc/gimplify.cc:622
622       tree var = create_tmp_var (type, get_name (val));
(gdb) p debug_generic_expr(val)
{}
$1 = void
(gdb) p debug_generic_expr(type)
struct mutex
$2 = void

#8  0x0000000001876fc0 in gimple_regimplify_operands (stmt=0x7fffe240b8f0,
gsi_p=0x7fffffffd330) at ../../gcc/gimplify-me.cc:235
(gdb) p debug_gimple_stmt(stmt)
# .MEM = VDEF <.MEM>
MEM[(struct operation *)this_6(D) + 40B].D.375978.data_.mutex_ = {};
$11 = void

#13 0x0000000001da9a7c in gimple_expand_calls_inline (bb=0x7ffff217fae0,
id=0x7fffffffda50, to_purge=0x7fffffffda10) at ../../gcc/tree-inline.cc:5419
5419            inlined |= expand_call_inline (bb, stmt, id, to_purge);
(gdb) p debug_gimple_stmt(stmt)
# .MEM_15 = VDEF <.MEM_13>
this_6(D)->__op_ =
exec::__sequence_sndr::subscribe_t::operator()<exec::__seqexpr<<lambda closure
object>stdexec::{anonymous}::<lambda()>(), stdexec::{anonymous}::__anon>&,
exec::__ignore_all_values::__receiver<stdexec::__sync_wait::__receiver<>,
std::variant<std::monostate, std::tuple<stdexec::__rcvrs::set_error_t,
std::__exception_ptr::exception_ptr> > >::__t> (&subscribe, __sndr_14(D),
&D.480887); [return slot optimization]

Reply via email to