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]

Re: Suggestion for function attributes on x86 architecture


> <<.global _MyFunc
> _MyFunc:
>   sub esp,4
>   pusha
>   mov [esp],12345678
>   add esp,4
>   ret
> >>
> 
> Hmmm, I don't think the above is a very good advertisement. It sure
> invites the comment that this allows you to get into trouble easily :-)

As a programmer I want be able to get the full control over my code,
and then this surely could produce unpredictable results:

void MyFunc() {
  int a;
  a=12345; 
  /* surely this could produce unpredictable results, but this is my 
  problem, not the compilers problem */
}

So, either we use something like this:
register int a asm("eax") or memory int a asm("esp-4")
or we save all registers with pusha/popa before modifing anything.
Using naked functions is not impossible.

Benjamin


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