-O2/-O3 Optimization bug?

Johannes Pfau nospam at example.com
Fri Jan 24 11:09:14 PST 2014


Am Fri, 24 Jan 2014 11:12:36 +0000
schrieb "Mike" <none at none.com>:

> That appears to be it.  I added memory to the clobber list and it 
> worked without any extra modifiers.  And, my executable is now 
> only 56 bytes.  It still doesn't do anything useful, but it's 
> small and optimized :-)
> 
> Thanks so much for the information and the help.
> 

You're welcome!

BTW: The optimizer generated this code for SendCommand
mov r3, r0  @ command, command
mov r2, r1  @ message, message
mov r0, r3;     @ command
mov r1, r2;      @ message

It's a little bit unfortunate that you can't specify in extended inline
asm that you want a specific register on ARM (on x86 you could tell gcc
to use e.g. eax for this variable). Otherwise you could use something
like
    asm
    {
       "bkpt #0xAB"
	:                              
	: [cmd] "r0" command, [msg] "r1" message
	: ;
    };
and the compiler could avoid those useless moves.


More information about the D.gnu mailing list