This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR middle-end/22127
- From: Ian Lance Taylor <ian at airs dot com>
- To: Eric Botcazou <ebotcazou at libertysurf dot fr>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 09 Nov 2005 13:43:42 -0800
- Subject: Re: [PATCH] Fix PR middle-end/22127
- References: <200511092231.04949.ebotcazou@libertysurf.fr>
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