[Bug middle-end/84150] Wrong pointer size used in builtin setjmp/longjmp with -maddress-mode=long
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jan 31 16:44:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84150
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-01-31
CC| |ebotcazou at gcc dot gnu.org
Component|target |middle-end
Ever confirmed|0 |1
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
A run-time testcase:
[hjl@gnu-skx-1 pr84150]$ cat x.i
void *buf[6] = {
(void *) -1,
(void *) -1,
(void *) -1,
(void *) -1,
(void *) -1,
(void *) -1
};
void raise0(void)
{
__builtin_longjmp (buf, 1);
}
int execute(int cmd)
{
int last = 0;
if (__builtin_setjmp (buf) == 0)
while (1)
{
last = 1;
raise0 ();
}
if (last == 0)
return 0;
else
return cmd;
}
int main(void)
{
if (execute (1) == 0)
__builtin_abort ();
if (buf[5] != (void *) -1)
__builtin_abort ();
return 0;
}
[hjl@gnu-skx-1 pr84150]$ make CC=gcc
gcc -O2 -mx32 -maddress-mode=long -S x.i
gcc -O2 -mx32 -maddress-mode=long -o x x.s
./x
make: *** [Makefile:13: all] Aborted
[hjl@gnu-skx-1 pr84150]$
expand_builtin_setjmp_setup and expand_builtin_longjmp shouldn't use Pmode
to save and store SP, FP and IP into (void *) slots, which are ptr_mode,
32 bits.
More information about the Gcc-bugs
mailing list