This is the mail archive of the gcc-patches@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: [PATCH] Fix PR middle-end/22127


Eric Botcazou <ebotcazou@libertysurf.fr> writes:

> This is a regression at -O from GCC 2.95.3 present on all active branches, 
> although it probably worked by accident with 2.95.3.
> 
> GCC doesn't treat getcontext() specially, although the function has the same 
> semantics as setjmp() that GCC does treat specially.
> 
> The proposed fix is to teach special_function_p about getcontext().  Tested on 
> sparc64-sun-solaris2.9 and sparc-sun-solaris2.8.  OK for all branches?
> 
> 
> 2005-11-09  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	PR middle-end/22127
> 	* calls.c (special_function_p): Set ECF_RETURNS_TWICE for getcontext.
> 
> 
> 2005-11-09  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* gcc.dg/sparc-getcontext-1.c: New test.

The problem I see here is that getcontext is not an ISO C or POSIX
function.  Users might legitimately name one of their own functions
'getcontext'.  And setting ECF_RETURNS_TWICE on every function named
'getcontext' is going to lead to warnings like
    variable 'foo' might be clobbered by 'longjmp' or 'vfork'
in a function which does not call either function.

Much as I hate to suggest fixincludes, I think the right way to fix
this is to use it to edit ucontext.h to add the "returns_twice"
attribute to the getcontext function declaration.

In fact all of the special_function_p cases should probably be handled
that way.

Ian


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