This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch,avr] Fix PR57844
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Denis Chertykov <chertykov at gmail dot com>, Eric Weddington <eric dot weddington at atmel dot com>
- Date: Wed, 10 Jul 2013 11:35:54 +0200
- Subject: [patch,avr] Fix PR57844
The problem with this PR is that -size is used as addend in
avr_prologue_setup_frame instead of truncating it to the mode of the operation.
Fix as obvious.
Ok for trunk and backport?
Johann
PR target/57844
* config/avr/avr.c (avr_prologue_setup_frame): Trunk -size to mode
of my_fp.
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c (revision 200865)
+++ config/avr/avr.c (working copy)
@@ -1112,7 +1112,7 @@ avr_prologue_setup_frame (HOST_WIDE_INT
leaf function and thus X has already been saved. */
int irq_state = -1;
- HOST_WIDE_INT size_cfa = size;
+ HOST_WIDE_INT size_cfa = size, neg_size;
rtx fp_plus_insns, fp, my_fp;
gcc_assert (frame_pointer_needed
@@ -1151,6 +1151,7 @@ avr_prologue_setup_frame (HOST_WIDE_INT
}
size = trunc_int_for_mode (size, GET_MODE (my_fp));
+ neg_size = trunc_int_for_mode (-size, GET_MODE (my_fp));
/************ Method 1: Adjust frame pointer ************/
@@ -1171,7 +1172,8 @@ avr_prologue_setup_frame (HOST_WIDE_INT
}
insn = emit_move_insn (my_fp, plus_constant (GET_MODE (my_fp),
- my_fp, -size));
+ my_fp, neg_size));
+
if (frame_pointer_needed)
{
RTX_FRAME_RELATED_P (insn) = 1;