https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123870
--- Comment #18 from Ilya Kurdyukov <jpegqs at gmail dot com> --- I tried to find out what exactly in -O2 is causing the problem. It seems to be in instruction scheduling: -O2 : wrong result -O1 : correct -O1 -fschedule-insns : wrong result -O2 -fno-schedule-insns : correct -O3 -fno-schedule-insns : correct
