diff mbox

[avr] Fix PR57844

Message ID 51DD2AFA.6010500@gjlay.de
State New
Headers show

Commit Message

Georg-Johann Lay July 10, 2013, 9:35 a.m. UTC
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.

Comments

Denis Chertykov July 10, 2013, 12:21 p.m. UTC | #1
2013/7/10 Georg-Johann Lay <avr@gjlay.de>:
> 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.

Approved.

Denis.
diff mbox

Patch

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;