------- Comment #4 from samuel dot thibault at ens-lyon dot org  2005-10-28 
00:21 -------
Well, there is indeed an issue: the address of some local variables might be
passed to other functions and then be modified in an external way between
setjmp() and longjmp(), and if some local variables are still in registers when
setjmp is executed, longjmp will restore the value they had _before_ setjmp.
This is expected when using sjlj. Now, inlining a function makes the caller be
hit by this issue too, which is no good.

But gcc might check that at the time setjmp() is called no caller automatic
variables are in registers, or it might even automatically consider them as
volatile in the callee (just like it does for extern variables, I guess, since
these _must_ have the value as of the time longjmp() was called).

So yes, inlining functions that use sjlj makes sense and can be implemented,
this is a opened bug, not a feature (btw, the error message is "sorry,
unimplemented: function 'switchto' can never be inlined because it uses
setjmp", not "go read longjmp() documentation").


-- 

samuel dot thibault at ens-lyon dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24556

Reply via email to