This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
handling of FIXED_REGISTERS
- From: Olatunji Ruwase <tjruwase at transmeta dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 9 Mar 2004 12:03:44 -0800 (PST)
- Subject: handling of FIXED_REGISTERS
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