https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127300
Bug ID: 127300
Summary: m68k-elf-gcc segfault with dead code elimination
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: staphen at gmail dot com
Target Milestone: ---
We discovered a segmentation fault when testing the compatibility of various
compiler flags in our application using the m68k-amigaos-gcc compiler. We
reported the issue to the maintainer of that fork who proceeded to find a
reduced test case and test it against the m68k-elf-gcc compiler.
A summary of the issue is that it only occurs when compiling with -O1 and
-fext-dce together. It can be avoided by -fno-guess-branch-probability. It can
also be avoided by using -O2 despite the fact that this includes both
-fguess-branch-probability and -fext-dce.
The full details of our findings can be found in the issue report on their
GitHub repository.
https://github.com/AmigaPorts/m68k-amigaos-gcc/issues/34
I've also attached the test case that reproduces the error. In addition, the
maintainer of the AmigaOS compiler provided the following link to demonstrate
the error.
https://franke.ms/cex/z/foExnG