https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96211
Bug ID: 96211 Summary: Segmentation fault when using "-O2 -fno-dce -fno-tree-dce" but passing at -O2 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: chenjunjie9208 at 163 dot com CC: marxin at gcc dot gnu.org Target Milestone: --- Hi, I came across a bug recently. The following simplified code is miscompiled with current gcc trunk using "-O2 -fno-dce -fno-tree-dce" on x86_64 GNU/Linux. It will report "Segmentation fault (core dumped)". However, when using any optimization levels (e.g., -O2, -O3), it does not have any problems. Looking forward to your reply, Thanks! $ gcc --version gcc (GCC) 11.0.0 20200715 (experimental) $ $ gcc -O2 -fno-dce -fno-tree-dce a.c; ./a.out Segmentation fault (core dumped) $ gcc -O3 -fno-dce -fno-tree-dce a.c; ./a.out Segmentation fault (core dumped) $ gcc -Os -fno-dce -fno-tree-dce a.c; ./a.out Segmentation fault (core dumped) $ $ gcc -O1 -fno-dce -fno-tree-dce a.c; ./a.out $ gcc -O3 a.c; ./a.out $ gcc -Os a.c; ./a.out $ gcc -O2 a.c; ./a.out $ gcc -O1 a.c; ./a.out $ gcc -O0 a.c; ./a.out $ --------------------------- static int *a(); void b() { a(); } int *a(int c, int *d) { int e = 0 >= *d; } int main() { b(); }