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 > instead. > > 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? Thanks, Richard. > > Thanks > Bernd. > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)