> Ah - you are worried about the case where STACK_SAVEAREA_MODE() is
> smaller than Pmode, yes ?
No, simply that the modified formula is plain wrong. The code does:
tmp = size_int (5 * BITS_PER_WORD / POINTER_SIZE - 1);
tmp = build_index_type (tmp);
tmp = build_array_type (ptr_type_node, tmp);
so, in the end, the size of the buffer is:
[(5 * BITS_PER_WORD / POINTER_SIZE - 1) + 1] * POINTER_SIZE
which boilds down to:
5 * BITS_PER_WORD
provided that POINTER_SIZE <= BITS_PER_WORD.
So we have a problem if POINTER_SIZE > BITS_PER_WORD, in which case it's
sufficient to use 5 * POINTER_SIZE instead.
> OK then, how about this revised version of the patch where the size
> computation is now:
>
> tmp = size_int (MAX (GET_MODE_SIZE (STACK_SAVEAREA_MODE
> (SAVE_NONLOCAL))
> / GET_MODE_SIZE (Pmode), 1)
> + 2 /* Stack pointer and frame pointer. */
> + 1 /* Slop for mips. */
> - 1);
>
> OK to apply ?
No, that's too complicated and risky, just do the following:
/* builtin_setjmp takes a pointer to 5 words or pointers. */
if (POINTER_SIZE > BITS_PER_WORD)
tmp = size_int (4);
else
tmp = size_int (5 * BITS_PER_WORD / POINTER_SIZE - 1);
which is simple and safe.
--
Eric Botcazou