In Seoul Virtual Machine Monitor project, I encountered this inline assembler code
asm volatile ("call %P0; 1:" : : "i"(foo))
which compiles and runs well when optimized with -O2; but fails to compile with -O0 optimization, yielding this error:
error: impossible constraint in ‘asm’
foo is a 32 bits int taken as an immediate value for the call instruction.
When I googled, this suggests me to replace "i" constraint by "ic", which I did; and now the code compile but with :
Warning: indirect call without « * »
How can I avoid this warning?
NB:
- gcc version is 4.9.2
- asm %P modifier is to prevent GCC to append $ in front of the int value. That is to generate "call foo" instead of "call $foo".