ARM Cortex-M Broken Binaries with -O2 and -O3 (-fschedule-insns)

Mike via D.gnu d.gnu at puremagic.com
Fri Jul 21 16:44:53 PDT 2017


My stm32 demo has now been updated and working with GDC/GCC 
7.1.0.  Thanks for all your improvements.

However, I'm getting broken binaries with -O2 and -O3.  I've 
nailed the culprit down to -fschedule-insns (i.e. if I add 
-fno-schedule-insns to -O2 or -O3, the binary works fine).

I disassembled '-O2' and '-O2 -fno-schedule-insns' and compared 
them, but they were quite different all the way through.  No only 
because of address locations, but also different registers and 
even different opcodes.  (e.g. 'str r2, [sp, #12]' vs 'strd r1, 
r2, [sp, #8]')

Is there anything I can do to provide more actionable information 
to help identify the underlying cause?

Mike


More information about the D.gnu mailing list