noreturn function attribute and ret asm instruction

Kristis Makris kristis.makris@asu.edu
Fri Sep 12 01:29:00 GMT 2003


On Tue, 2003-09-02 at 14:56, Zack Weinberg wrote: 
> Jim Wilson <wilson@tuliptree.org> writes:
> > The real problem here is that we have no support for asms that change
> > flow of control.  Adding a function attribute to suppress the ret does
> > not fix this.  Letting asms change flow of control would require syntax
> > and semantic changes.  This would be a major change, and it isn't clear
> > if it is a good idea.  It might impede optimization so much that it
> > hurts more than it helps.

On the same note, is there any way to tell gcc that it should create
code for a function that will leave the state of the registers exactly
as it was originally when the function was entered ? Is there some
function attribute for that ? So if the caller was already using certain
registers, can the responsibility of preserving those be somehow
offloaded to the callee ? Can I generate "a chunk of code" that does not
mess with the state of the processor, just like I would if the same code
was written in asm ?

I don't know if gcc was meant not to do that by design.




More information about the Gcc-bugs mailing list