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: Jakub Jelinek <jakub at redhat dot com>
- To: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 19 Jul 2016 18:37:38 +0200
- 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> <AM4PR0701MB2162EA032484BB9F00425151E4370@AM4PR0701MB2162.eurprd07.prod.outlook.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Jul 19, 2016 at 04:20:55PM +0000, Bernd Edlinger wrote:
> 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.
> Moreover, from the backend library we cannot check flag_hosted, or if
> the function has "C" or "C++" binding.
I believe this will regress handling of various functions.
E.g. for alloca (as opposed to __builtin_alloca/__builtin_alloca_with_align,
this means EFC_MAY_BE_ALLOCA will not be set anymore.
_longjmp/siglongjmp will no longer be ECF_NORETURN (glibc
doesn't declare them as such), __sigsetjmp will no longer be ECF_LEAF.