http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56715



Jakub Jelinek <jakub at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |jakub at gcc dot gnu.org



--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-03-25 
08:50:15 UTC ---

Simply don't use const on the register asm vars for C++.  The thing is that

already the C++ frontend is replacing all the r4 const var uses with just

0x1000 (i.e. the initializer), that isn't really an optimization, but part of

C++ semantics.  r4 is an integral constant expression that evaluates to 0x1000.

 See

ISO C++ 98, [expr.const]/1.  So in foo what you are doing is actually

void foo() {

    register const int r4 asm("r4") = 0x1000;

    asm volatile("swi #1" : : "r"(0x1000));

}

and that of course can use any available register.

Reply via email to