This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]