https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127365
Bug ID: 127365
Summary: [16 Regression] ICE in good_cloning_opportunity_p with
-O3 -flto (ipa-cp clone candidate with prop_size_cost
== 0)
Product: gcc
Version: 16.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: wszqkzqk at qq dot com
Target Milestone: ---
Building SPIRV-Cross 1.4.357.0 with LTO on loongarch64-unknown-linux-gnu with
GCC 16.2.1 makes `lto1` ICE during the WPA phase when linking the test
executables:
```
during IPA pass: cp
lto1: internal compiler error: in good_cloning_opportunity_p, at ipa-cp.cc:3464
```
And I've fount that line 3464 in releases/gcc-16 is `gcc_assert (size_cost >
0);`.
## Reproducer
```
git clone https://github.com/KhronosGroup/SPIRV-Cross -b vulkan-sdk-1.4.357.0
cd SPIRV-Cross
./checkout_glslang_spirv_tools.sh
./build_glslang_spirv_tools.sh # enables the test suite in cmake
CXXFLAGS="-O2 -g -ffat-lto-objects -Wp,-D_FORTIFY_SOURCE=3
-Wp,-D_GLIBCXX_ASSERTIONS" \
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j$(nproc)
```