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

--- Comment #2 from Ivan Lazaric <ivan.lazaric.gcc at gmail dot com> ---
Slight simplification further:
```cpp
struct Y;

template<class T>
constexpr void g() { T().f(); }

struct V {
  void (*f)();
  constexpr V(auto) : f(g<Y>) {}  
};

void f() { V{1}; }

struct Y { consteval void f(); };
```

It also can ICE, only saw it on gcc built with `--enable-checking=yes`,
not `release`

```
prog.cpp:13:27: warning: inline function 'consteval void Y::f()' used but never
defined
   13 | struct Y { consteval void f(); };
      |                           ^
prog.cpp: In function 'void f()':
prog.cpp:11:15: internal compiler error: in cp_gimplify_expr, at
cp/cp-gimplify.cc:1049
   11 | void f() { V{1}; }
      |               ^
0x2b73afb internal_error(char const*, ...)
       
/home/ilazaric/repos/ALL/submodules/gcc/gcc/diagnostic-global-context.cc:787
0xb339b9 fancy_abort(char const*, int, char const*)
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/diagnostics/context.cc:1823
0x815e6e cp_gimplify_expr(tree_node**, gimple**, gimple**)
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/cp/cp-gimplify.cc:1049
0x122114d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:20422
0x123a32e gimplify_target_expr
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:8490
0x12224a2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:20919
0x1222987 gimplify_cleanup_point_expr
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:8577
0x1222987 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:20915
0x12476ba gimplify_stmt(tree_node**, gimple**)
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:8577
0x12476ba gimplify_body(tree_node*, bool)
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:21823
0x1247b97 gimplify_function_tree(tree_node*)
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:22032
0xff6847 cgraph_node::analyze()
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/cgraphunit.cc:691
0xff92a7 analyze_functions
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/cgraphunit.cc:1270
0xffa096 symbol_table::finalize_compilation_unit()
        /home/ilazaric/repos/ALL/submodules/gcc/gcc/cgraphunit.cc:2593
/opt/GCC/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1plus -quiet -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE prog.cpp -quiet -dumpbase prog.100.cpp
-dumpbase-ext .cpp -mtune=generic -march=x86-64 -std=c++26 -o prog.100.out
```

The ICE can be seen in godbolt
(you just might need to recompile a couple of times)
https://godbolt.org/z/vsc7fd8jY

Noting, for the ICE I was building with "-S" instead of "-fsyntax-only"

Runner script:
```bash
#!/usr/bin/env bash

set -euo pipefail

seq 1 100 | parallel -j 10 'g++ prog.cpp -std=c++26 -S -o prog.{}.out &> out.{}
&& echo $? > ec.{} || echo $? > ec.{}'
```

Reply via email to