aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Krebbel <krebbel@linux.ibm.com>2018-08-09 07:06:23 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2018-08-09 07:06:23 +0000
commit0b06c9a6da753ceb79b0eb6cc8c265e14fcd20d3 (patch)
treef338f7e98d354131d75dc1a24163a914cabe35b4
parenta0de11f47fde9e4af00cff2aeca8054ba5769b05 (diff)
downloadgcc-0b06c9a6da753ceb79b0eb6cc8c265e14fcd20d3.zip
gcc-0b06c9a6da753ceb79b0eb6cc8c265e14fcd20d3.tar.gz
gcc-0b06c9a6da753ceb79b0eb6cc8c265e14fcd20d3.tar.bz2
S/390: Fix PR84332 ICE with stack clash protection
Our implementation of the stack probe requires the probe interval to be used as displacement in an address operand. The maximum probe interval currently is 64k. This would exceed short displacements. Trim that value down to 4k if that happens. This might result in too many probes being generated only on the oldest supported machine level z900. gcc/ChangeLog: 2018-08-09 Andreas Krebbel <krebbel@linux.ibm.com> PR target/84332 * config/s390/s390.c (s390_option_override_internal): Reduce the stack-clash-protection-probe-interval param if it would be too big for z900. gcc/testsuite/ChangeLog: 2018-08-09 Andreas Krebbel <krebbel@linux.ibm.com> PR target/84332 * gcc.target/s390/pr84332.c: New testcase. From-SVN: r263441
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/s390/s390.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/s390/pr84332.c9
4 files changed, 32 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e8f65c9..e2ae04d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-08-09 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ PR target/84332
+ * config/s390/s390.c (s390_option_override_internal): Reduce the
+ stack-clash-protection-probe-interval param if it would be too big
+ for z900.
+
2018-08-08 Andreas Schwab <schwab@linux-m68k.org>
PR target/46179
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index d533a3f..d5511d0 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -14983,6 +14983,17 @@ s390_option_override_internal (struct gcc_options *opts,
else if (opts->x_s390_stack_guard)
error ("-mstack-guard implies use of -mstack-size");
+ /* Our implementation of the stack probe requires the probe interval
+ to be used as displacement in an address operand. The maximum
+ probe interval currently is 64k. This would exceed short
+ displacements. Trim that value down to 4k if that happens. This
+ might result in too many probes being generated only on the
+ oldest supported machine level z900. */
+ if (!DISP_IN_RANGE ((1 << PARAM_VALUE (PARAM_STACK_CLASH_PROTECTION_PROBE_INTERVAL))))
+ set_param_value ("stack-clash-protection-probe-interval", 12,
+ opts->x_param_values,
+ opts_set->x_param_values);
+
#ifdef TARGET_DEFAULT_LONG_DOUBLE_128
if (!TARGET_LONG_DOUBLE_128_P (opts_set->x_target_flags))
opts->x_target_flags |= MASK_LONG_DOUBLE_128;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 779b50f..592e3ec 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-09 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ PR target/84332
+ * gcc.target/s390/pr84332.c: New testcase.
+
2018-08-08 Andreas Schwab <schwab@linux-m68k.org>
PR target/46179
diff --git a/gcc/testsuite/gcc.target/s390/pr84332.c b/gcc/testsuite/gcc.target/s390/pr84332.c
new file mode 100644
index 0000000..3dec99f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/pr84332.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-march=z900 -fstack-clash-protection --param stack-clash-protection-probe-interval=16" } */
+
+struct b
+{
+ char a[65536];
+};
+
+void c (void) { struct b d; }