+2018-04-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/85173
+ * explow.c (emit_stack_probe): Call validize_mem on memory location
+ before passing it to gen_probe_stack. Create address operand and
+ legitimize it for the probe_stack_address case.
+
2018-04-09 Jan Hubicka <jh@suse.cz>
PR lto/85078
emit_stack_probe (rtx address)
{
if (targetm.have_probe_stack_address ())
- emit_insn (targetm.gen_probe_stack_address (address));
+ {
+ struct expand_operand ops[1];
+ insn_code icode = targetm.code_for_probe_stack_address;
+ create_address_operand (ops, address);
+ maybe_legitimize_operands (icode, 0, 1, ops);
+ expand_insn (icode, 1, ops);
+ }
else
{
rtx memref = gen_rtx_MEM (word_mode, address);
MEM_VOLATILE_P (memref) = 1;
+ memref = validize_mem (memref);
/* See if we have an insn to probe the stack. */
if (targetm.have_probe_stack ())
- emit_insn (targetm.gen_probe_stack (memref));
+ emit_insn (targetm.gen_probe_stack (memref));
else
- emit_move_insn (memref, const0_rtx);
+ emit_move_insn (memref, const0_rtx);
}
}
--- /dev/null
+/* PR target/85173. */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fstack-clash-protection --param stack-clash-protection-probe-interval=14" } */
+/* { dg-require-effective-target arm_thumb2_ok } */
+
+__attribute__((noinline, noclone)) void
+foo (char *p)
+{
+ asm volatile ("" : : "r" (p) : "memory");
+}
+
+/* Nonconstant alloca, small local frame. */
+__attribute__((noinline, noclone)) void
+f5 (int x)
+{
+ char locals[128];
+ char *vla = __builtin_alloca (x);
+ foo (vla);
+}