handling of FIXED_REGISTERS
Olatunji Ruwase
tjruwase@transmeta.com
Tue Mar 9 20:04:00 GMT 2004
I have question regarding the handling of FIXED_REGISTERS in gcc. These
are hard registers which are specified by different architectures as not
available to the compiler for general allocation. For example "sp" in
i386. However while the compiler respects this restriction during
register allocation, this restriction is not extended to inline assembly.
Therefore it is possible to use sp in inline assembly as follows,
register int foo asm("sp")
allowing the programmer code to clobber "sp" arbitrarily.
While I cant think of any useful reason to write code of such nature, I m
curious as to why gcc is designed not to reject it.
Thanks
tunji
More information about the Gcc
mailing list