> 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;

  /* The number of Pmode words for the setjmp buffer, when using the
     builtin setjmp/longjmp, see expand_builtin, case
  size = 5;

so the tests are incorrect, not the implementation.

Eric Botcazou

Reply via email to