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 unsafe function attributes for special functions (PR 71876)


On 07/20/2016 10:30 AM, Bernd Edlinger wrote:
On 07/20/16 18:15, Jeff Law wrote:
On 07/20/2016 05:53 AM, Richard Biener wrote:
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?
That is correct.  __builtin_setjmp (and friends) are part of the SJLJ
exception handling code.   They use a fixed sized buffer (5 words) to
store the key items (as opposed to the OS defined jmp_buf structure
which is usually considerably larger).

jeff

Yes. __builtin_setjmp is declared in builtins.def:

DEF_GCC_BUILTIN        (BUILT_IN_SETJMP, "setjmp", BT_FN_INT_PTR,
ATTR_NOTHROW_LEAF_LIST)

It is visible in C as __builtin_setjmp, and it special_function_p
adds the ECF_RETURNS_TWICE | ECF_LEAF.

So it becomes equivalent to this:

int __builtin_setjmp(void*) __attribute__((returns_twice, nothrow,
leaf))

after special_function_p does it's magic.

If I remove the recognition of "__builtin_" from special_function_p
I have to add the returns_twice attribute in the DEF_GCC_BUILTIN.
Otherwise, I would get wrong code on all platforms, because
__builtin_setjmp saves only IP, SP, and FP registers.

Everything in the normal test suite keeps on going with the patch,
but is there anything that I have to do to make sure that the
SJLJ eh is still working? It is not the default on x86_64, right?
Very few targets continue to use SJLJ eh (perhaps just cygwin/mingw). *But* I think the Ada front-end explicitly uses SJLJ EH, so if you want to get some smoke testing, the Ada testsuite is probably the place to go.

Jeff


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