https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103247
Bug ID: 103247 Summary: graphite: Wrong code when at -O1 or higher and -floop-nest-optimize is given without an earlier tree-cunrolli pass Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: stammark at gcc dot gnu.org Target Milestone: --- Hi all, I'm coming across a strange optimisation bug that happens if I try to combine -O1 with the Graphite -floop-nest-optimize on test interchange-8 I initially spotted the symptom when compiling as: ./bin/aarch64-none-elf-gcc ../src/gcc/gcc/testsuite/gcc.dg/graphite/interchange-8.c -march=armv8-a -specs=aem-validation.specs -o test.out -O1 -floop-nest-optimize And then running on a simulator resulted in the abort () function being called. and then replicated on x86 as: gcc ../src/gcc/gcc/testsuite/gcc.dg/graphite/interchange-8.c -o test.out -O1 -floop-nest-optimize ; ./test.out Which gives an `Aborted (core dumped)` Some further digging showed that the execution failure seems to be something in the graphite/loop-nest-optimize pass that requires a tree-cunrolli pass to have been done earlier, for this test's source code, so: # The test always runs with -floop-nest-optimize # O2 and O3 constain tree-cunrolli # O0 and O1 don't contain tree-cunrolli -O0 -floop-nest-optimize: works (no abort () was called) -O0 -fenable-tree-cunrolli -floop-nest-optimize: works -O1 -floop-nest-optimize: broken -O1 -fenable-tree-cunrolli -floop-nest-optimize: works -O2 -floop-nest-optimize: works -O2 -fdisable-tree-cunrolli -floop-nest-optimize: broken -O3 -floop-nest-optimize: works -O3 -fdisable-tree-cunrolli -floop-nest-optimize: broken Is anyone aware of such a dependency between these passes and/or is this a real bug or am I missing something? Replicated on latest trunk and GCC-11. Thanks!