https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103314
Bug ID: 103314
Summary: ICE on valid code at -O1 and above on
x86_64-linux-gnu: Segmentation fault
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: zhendong.su at inf dot ethz.ch
Target Milestone: ---
It seems to be a recent regression.
[585] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211118 (experimental) [master r12-5359-g280d2838c11] (GCC)
[586] %
[586] % gcctk -O0 small.c; ./a.out
[587] %
[587] % gcc110 -O1 small.c; ./a.out
small.c: In function ‘main’:
small.c:3:37: warning: right shift count is negative [-Wshift-count-negative]
3 | unsigned c = 0, d = c ? 1 ^ c ^ 1 >> a : 0;
| ~~^~~~
[588] %
[588] % gcctk -O1 small.c
small.c: In function ‘main’:
small.c:3:37: warning: right shift count is negative [-Wshift-count-negative]
3 | unsigned c = 0, d = c ? 1 ^ c ^ 1 >> a : 0;
| ~~^~~~
gcctk: internal compiler error: Segmentation fault signal terminated program
cc1
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
[589] %
[589] % cat small.c
const int a = -1;
int main() {
unsigned c = 0, d = c ? 1 ^ c ^ 1 >> a : 0;
return 0;
}