On Mon, 16 Oct 2017, Qing Zhao wrote: > resend this patch for middle-end to review. > > this patch was originally sent to aarch64 for review in the beginning: > > https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00404.html > <https://gcc.gnu.org/ml/gcc-patches/2017-10/msg00404.html> > The implementation of __builtin_update_setjmp_buf is not correct. It takes a > pointer > as an operand and treats the Mode of the pointer as Pmode, which is not > correct. > a conversion from ptr_mode to Pmode is needed for this pointer. > > bootstrapped and tested on both aarch64-unknown-linux-gnu and > x86_64-pc-linux-gnu, > no regressions. > > Wilco helped me a lot during fixing this bug. > > Okay for trunk?
Ok. Richard. > the patch is: > > gcc/ChangeLog > > 2017-10-16 Qing Zhao <qing.z...@oracle.com> > Wilco Dijkstra <wilco.dijks...@arm.com> > > * builtins.c (expand_builtin_update_setjmp_buf): Add a > converstion to Pmode from the buf_addr. > > gcc/testsuite/ChangeLog > > 2017-10-16 Qing Zhao <qing.z...@oracle.com> > Wilco Dijkstra <wilco.dijks...@arm.com> > > PR middle-end/80295 > * gcc.target/aarch64/pr80295.c: New test. > > --- > gcc/builtins.c | 1 + > gcc/testsuite/gcc.target/aarch64/pr80295.c | 8 ++++++++ > 2 files changed, 9 insertions(+) > create mode 100644 gcc/testsuite/gcc.target/aarch64/pr80295.c > > diff --git a/gcc/builtins.c b/gcc/builtins.c > index c8a5ea6..01fb08b 100644 > --- a/gcc/builtins.c > +++ b/gcc/builtins.c > @@ -1199,6 +1199,7 @@ void > expand_builtin_update_setjmp_buf (rtx buf_addr) > { > machine_mode sa_mode = STACK_SAVEAREA_MODE (SAVE_NONLOCAL); > + buf_addr = convert_memory_address (Pmode, buf_addr); > rtx stack_save > = gen_rtx_MEM (sa_mode, > memory_address > diff --git a/gcc/testsuite/gcc.target/aarch64/pr80295.c > b/gcc/testsuite/gcc.target/aarch64/pr80295.c > new file mode 100644 > index 0000000..b3866d8 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/pr80295.c > @@ -0,0 +1,8 @@ > +/* { dg-do compile } */ > +/* { dg-options "-mabi=ilp32" } */ > + > +void f (void *b) > +{ > + __builtin_update_setjmp_buf (b); > +} > + > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)