This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][Middle-end]Fix PR80295 [7/8 Regression] ICE in __builtin_update_setjmp_buf expander
- From: Richard Biener <rguenther at suse dot de>
- To: Qing Zhao <qing dot zhao at oracle dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, law at redhat dot com, wilco Dijkstra <wilco dot dijkstra at arm dot com>
- Date: Tue, 17 Oct 2017 15:26:09 +0200 (CEST)
- Subject: Re: [PATCH][Middle-end]Fix PR80295 [7/8 Regression] ICE in __builtin_update_setjmp_buf expander
- Authentication-results: sourceware.org; auth=none
- References: <1ADF3CD0-0959-4F9E-8F19-C4371E858374@oracle.com>
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.zhao@oracle.com>
> Wilco Dijkstra <wilco.dijkstra@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.zhao@oracle.com>
> Wilco Dijkstra <wilco.dijkstra@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 <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)