This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix unsafe function attributes for special functions (PR 71876)
- From: Richard Biener <rguenther at suse dot de>
- To: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- Cc: "jakub at redhat dot com" <jakub at redhat dot com>, Jeff Law <law at redhat dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, ebotcazou at adacore dot com
- Date: Wed, 20 Jul 2016 13:53:22 +0200 (CEST)
- Subject: Re: [PATCH] Fix unsafe function attributes for special functions (PR 71876)
- Authentication-results: sourceware.org; auth=none
- References: <AM4PR0701MB216226C00439A01515A3AA5FE4370@AM4PR0701MB2162.eurprd07.prod.outlook.com> <alpine.LSU.email@example.com> <alpine.LSU.firstname.lastname@example.org> <AM4PR0701MB2162F941CAB008360282B6B5E4080@AM4PR0701MB2162.eurprd07.prod.outlook.com>
On Wed, 20 Jul 2016, Bernd Edlinger wrote:
> On 07/20/16 12:46, Richard Biener wrote:
> > On Wed, 20 Jul 2016, Richard Biener wrote:
> >> On Tue, 19 Jul 2016, Bernd Edlinger wrote:
> >>> Hi!
> >>> As discussed at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71876,
> >>> we have a _very_ old hack in gcc, that recognizes certain functions by
> >>> name, and inserts in some cases unsafe attributes, that don't work for
> >>> a freestanding environment.
> >>> It is unsafe to return ECF_MAY_BE_ALLOCA, ECF_LEAF and ECF_NORETURN
> >>> from special_function_p, just by the name of the function, especially
> >>> for less well known functions, like "getcontext" or "savectx", which
> >>> could easily used for something completely different.
> >> Returning ECF_MAY_BE_ALLOCA is safe. Just wanted to mention this,
> >> regardless of the followups you already received.
> > Oh, and maybe you can factor out the less controversical parts,
> > namely ignoring the __builtin_ prefix. I don't think that
> > calling __builtin_setjmp in an environment where setjmp is not a
> > builtin should beave like setjmp (it will call a function named
> > '__builtin_setjmp').
> I wonder how I manage to dig out such contriversical things ;)
> But you are right, that would at least be a start.
> So this patch is what you requested:
> Remove the handling of the __builtin_ prefix from special_function_p
> and add the returns_twice attribute to the __builtin_setjmp declaration
> Is it OK after boot-strap and regression-testing?
I think the __builtin_setjmp change is wrong - __builtin_setjmp is
_not_ 'setjmp' it is part of the GCC internal machinery (using setjmp
and longjmp in the end) for SJLJ exception handing.
Am I correct Eric?
Richard Biener <email@example.com>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)