summaryrefslogtreecommitdiff
path: root/gcc/config/arm
diff options
context:
space:
mode:
authorgretay <gretay@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-19 12:55:26 +0000
committergretay <gretay@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-19 12:55:26 +0000
commita5c5144fad3f41434f0bbde85007ec3882ad4ce3 (patch)
treed427346b6e92609757c00d5e5ee52467426b530e /gcc/config/arm
parentd359df0c0eeff7ac4e3f1fb17d61741fa32e29e1 (diff)
downloadgcc-a5c5144fad3f41434f0bbde85007ec3882ad4ce3.tar.gz
2013-04-19 Greta Yorsh <Greta.Yorsh@arm.com>
PR target/56797 * config/arm/arm.c (load_multiple_sequence): Require SP as base register for loads if SP is in the register list. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198091 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/arm')
-rw-r--r--gcc/config/arm/arm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 9088d1a64ab..7567afc719a 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -10755,6 +10755,13 @@ load_multiple_sequence (rtx *operands, int nops, int *regs, int *saved_order,
|| (i != nops - 1 && unsorted_regs[i] == base_reg))
return 0;
+ /* Don't allow SP to be loaded unless it is also the base
+ register. It guarantees that SP is reset correctly when
+ an LDM instruction is interruptted. Otherwise, we might
+ end up with a corrupt stack. */
+ if (unsorted_regs[i] == SP_REGNUM && base_reg != SP_REGNUM)
+ return 0;
+
unsorted_offsets[i] = INTVAL (offset);
if (i == 0 || unsorted_offsets[i] < unsorted_offsets[order[0]])
order[0] = i;