https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106568
ktkachov at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ktkachov at gcc dot gnu.org --- Comment #1 from ktkachov at gcc dot gnu.org --- > We are fairly certain the problem is with the -freorder-blocks-algorithm > optimization. The problem we are now having is, we don't know how to disable > it. The following fails to compile: > > -fno-reorder-blocks-algorithm > -freorder-blocks-algorithm=none > -freorder-blocks-algorithm= > You should be able to use -fno-reorder-blocks to disable it. Alternatively, if you use -freorder-blocks-algorithm= you can only pass it the "simple" or "stc" options as per the documentation. This will pick one of the two available algorithms. That said, one major change that happened in GCC 12.1 was enabling auto-vectorisation by default at -O2. See https://gcc.gnu.org/gcc-12/changes.html The vectorisation at -O2 uses less aggressive heuristics than at -O3 so could trigger different behaviour than -O3 or lower options (where it doesn't vectorise at all). May be worth investigating.