From 0ab503d34f2a8c22262ceefea6c882ae2ff75230 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 3 Mar 2020 10:42:34 +0100 Subject: explow: Fix ICE caused by plus_constant [PR94002] The following testcase ICEs in cross to riscv64-linux. The problem is that we have a DImode integral constant (that doesn't fit into SImode), which is pushed into a constant pool and later access just the first half of it using a MEM. When plus_constant is called on such a MEM, if the constant has mode, we verify the mode, but if it doesn't, we don't and ICE later on when we think the CONST_INT is a valid SImode constant. 2020-03-03 Jakub Jelinek PR rtl-optimization/94002 * explow.c (plus_constant): Punt if cst has VOIDmode and get_pool_mode is different from mode. * gcc.dg/pr94002.c: New test. --- gcc/explow.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/explow.c') diff --git a/gcc/explow.c b/gcc/explow.c index 77f0c07..b838f03 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -128,6 +128,9 @@ plus_constant (machine_mode mode, rtx x, poly_int64 c, bool inplace) cst = gen_lowpart (mode, cst); gcc_assert (cst); } + else if (GET_MODE (cst) == VOIDmode + && get_pool_mode (XEXP (x, 0)) != mode) + break; if (GET_MODE (cst) == VOIDmode || GET_MODE (cst) == mode) { tem = plus_constant (mode, cst, c); -- cgit v1.1 From d3e5bae174d9d2ed115a364d5b404d179458a622 Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Thu, 14 May 2020 08:16:27 +0200 Subject: Make anti_adjust_stack_and_probe_stack_clash extern and use it for Z When compiling with -mbackchain -fstack-clash-protection currently no probes are emitted. This patch adjusts the "allocate_stack" expander to call anti_adjust_stack_and_probe_stack_clash when needed. In order to do this I had to export that function from explow.c. Ok for mainline? gcc/ChangeLog: 2020-05-14 Andreas Krebbel * config/s390/s390.md ("allocate_stack"): Call anti_adjust_stack_and_probe_stack_clash when stack clash protection is enabled. * explow.c (anti_adjust_stack_and_probe_stack_clash): Remove prototype. Remove static. * explow.h (anti_adjust_stack_and_probe_stack_clash): Add prototype. gcc/testsuite/ChangeLog: 2020-05-14 Andreas Krebbel * gcc.target/s390/stack-clash-3.c: New test. --- gcc/explow.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gcc/explow.c') diff --git a/gcc/explow.c b/gcc/explow.c index b838f03..15c9cfb 100644 --- a/gcc/explow.c +++ b/gcc/explow.c @@ -43,7 +43,6 @@ along with GCC; see the file COPYING3. If not see #include "output.h" static rtx break_out_memory_refs (rtx); -static void anti_adjust_stack_and_probe_stack_clash (rtx); /* Truncate and perhaps sign-extend C as appropriate for MODE. */ @@ -1948,7 +1947,7 @@ emit_stack_clash_protection_probe_loop_end (rtx loop_lab, rtx end_loop, allocate/probe beyond that because this probing style does not guarantee signal handling capability if the guard is hit. */ -static void +void anti_adjust_stack_and_probe_stack_clash (rtx size) { /* First ensure SIZE is Pmode. */ -- cgit v1.1