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

            Bug ID: 126095
           Summary: [Regression 13/14/15/16/17] ICE in
                    gimplify_var_or_parm_decl, at gimplify.cc:3060 with
                    c++20 ?: since r13-2964
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mjires at gcc dot gnu.org
                CC: jason at redhat dot com
  Target Milestone: ---

Compiling reduced testcase llvm/clang/test/Sema/LifetimeSafety/safety.cpp
results in ICE since r13-2964-gbbdb5612f6661f.

$ cat safety.cpp
struct TrueView {
  int p;
  constexpr TrueView() {}
  constexpr operator bool() { return true; }
} binary_conditional_folded_true_fb;

void binary_conditional_folded_true() {
  TrueView() ?: binary_conditional_folded_true_fb;
}


$ g++ safety.cpp -O2 -std=c++20
safety.cpp: In function ‘void binary_conditional_folded_true()’:
safety.cpp:8:14: internal compiler error: in gimplify_var_or_parm_decl, at
gimplify.cc:3298
    8 |   TrueView() ?: binary_conditional_folded_true_fb;
      |   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x29f1a7b internal_error(char const*, ...)
        /home/mjires/git/GCC/master/gcc/diagnostic-global-context.cc:787
0x29fcf63 fancy_abort(char const*, int, char const*)
        /home/mjires/git/GCC/master/gcc/diagnostics/context.cc:1813
0x1030557 gimplify_var_or_parm_decl
        /home/mjires/git/GCC/master/gcc/gimplify.cc:3298
0x103fb0f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/mjires/git/GCC/master/gcc/gimplify.cc:20925
0x1054f33 gimplify_modify_expr
        /home/mjires/git/GCC/master/gcc/gimplify.cc:7327
0x103e385 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/mjires/git/GCC/master/gcc/gimplify.cc:20458
0x1059d06 gimplify_target_expr
        /home/mjires/git/GCC/master/gcc/gimplify.cc:8489
0x103f7da gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/mjires/git/GCC/master/gcc/gimplify.cc:20861
0x10411fe gimplify_stmt(tree_node**, gimple**)
        /home/mjires/git/GCC/master/gcc/gimplify.cc:8570
0x10447e1 gimplify_cleanup_point_expr
        /home/mjires/git/GCC/master/gcc/gimplify.cc:8297
0x103f7c5 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/mjires/git/GCC/master/gcc/gimplify.cc:20857
0x10411fe gimplify_stmt(tree_node**, gimple**)
        /home/mjires/git/GCC/master/gcc/gimplify.cc:8570
0x1044d92 gimplify_body(tree_node*, bool)
        /home/mjires/git/GCC/master/gcc/gimplify.cc:21765
0x10452ca gimplify_function_tree(tree_node*)
        /home/mjires/git/GCC/master/gcc/gimplify.cc:21974
0xdf22af cgraph_node::analyze()
        /home/mjires/git/GCC/master/gcc/cgraphunit.cc:691
0xdf5082 analyze_functions
        /home/mjires/git/GCC/master/gcc/cgraphunit.cc:1270
0xdf634a symbol_table::finalize_compilation_unit()
        /home/mjires/git/GCC/master/gcc/cgraphunit.cc:2593
/home/mjires/built/master/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1plus -quiet
-D_GNU_SOURCE safety.cpp -quiet -dumpdir a- -dumpbase safety.cpp -dumpbase-ext
.cpp -mtune=generic -march=x86-64 -O2 -std=c++20 -o /tmp/ccjE3s81.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/mjires/built/master/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/mjires/git/GCC/master/configure
--prefix=/home/mjires/built/master --disable-bootstrap
--enable-languages=c,c++,fortran,lto --disable-multilib --disable-libsanitizer
--enable-checking : (reconfigured) /home/mjires/git/GCC/master/configure
--prefix=/home/mjires/built/master --disable-bootstrap
--enable-languages=c,c++,fortran,lto --disable-multilib --disable-libsanitizer
--enable-checking
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20260703 (experimental) (GCC)

Reply via email to