This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Use ptr_mode to save/restore pointers in builtin jmpbuf
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Fri, 02 Feb 2018 21:55:32 +0100
- Subject: Re: [PATCH] Use ptr_mode to save/restore pointers in builtin jmpbuf
- Authentication-results: sourceware.org; auth=none
- References: <20180201001627.GA21117@gmail.com> <3874588.EQjNKs4VoA@polaris> <CAMe9rOp7BB6oc8fLP2QD9+a0=K-3USN-DRai7ykW47sRiR0JJg@mail.gmail.com>
> But, that is not what the builtin setjmp/longjmp tests have.
Yes, but I don't think that we want to risk breaking a working compiler on
some targets because peculiar tests don't pass on another. I think that
init_eh is OK for x32 so SJLJ exceptions work and the issue is only with the
undocumented builtin setjmp/longjmp.
What happens on Aarch64 -milp32 for example? Would it be OK to save/restore
only 32-bit values? And MIPS n32?
Maybe we can define another builtin, e.g. __builtin_setjmp_size, and let the
compiler compute the size based on the same formula as init_eh or somesuch:
char buf[__builtin_setjmp_size ()];
Btw, the "array of pointers" thing is an interpolation, here's an excerpt of
start_dynamic_handler in GCC 2.8.x:
/* Emit RTL to start a dynamic handler on the EH runtime dynamic
handler stack. This should only be used by expand_eh_region_start
or expand_eh_region_start_tree. */
static void
start_dynamic_handler ()
{
rtx dhc, dcc;
rtx x, arg, buf;
int size;
#ifndef DONT_USE_BUILTIN_SETJMP
/* The number of Pmode words for the setjmp buffer, when using the
builtin setjmp/longjmp, see expand_builtin, case
BUILT_IN_LONGJMP. */
size = 5;
#else
so the tests are incorrect, not the implementation.
--
Eric Botcazou