[explow] PR target/85173: validize memory before passing it on to target probe_stack
commit5fdcac79eb72406c59fa72073dfb3ba21380f56d
authorktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Apr 2018 09:58:57 +0000 (10 09:58 +0000)
committerktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Apr 2018 09:58:57 +0000 (10 09:58 +0000)
tree27ab70f24b85e6e1612c9b21b667002c9e38b01e
parent3c24c320081d9f732d032b4b808d5dfec8b569b3
[explow] PR target/85173: validize memory before passing it on to target probe_stack

In this PR the expansion code emits an invalid memory address for the stack probe, which the backend fails to recognise.
The address is created explicitly in anti_adjust_stack_and_probe_stack_clash in explow.c and passed down to gen_probe_stack
without any validation in emit_stack_probe.

This patch fixes the ICE by calling validize_mem on the memory location before passing it down to the target.
Jakub pointed out that we also want to create valid addresses for the probe_stack_address case, so this patch
creates an expand operand and legitimizes it before passing it down to the probe_stack_address expander.

This patch passes bootstrap and testing on arm-none-linux-gnueabihf and aarch64-none-linux-gnu
and ppc64le-redhat-linux on gcc112 in the compile farm.

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.

* gcc.target/arm/pr85173.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259266 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/explow.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/pr85173.c [new file with mode: 0644]