Patchwork [avr] Fix PR57844

login
register
mail settings
Submitter Georg-Johann Lay
Date July 10, 2013, 9:35 a.m.
Message ID <51DD2AFA.6010500@gjlay.de>
Download mbox | patch
Permalink /patch/257993/
State New
Headers show

Comments

Georg-Johann Lay - July 10, 2013, 9:35 a.m.
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.
Denis Chertykov - July 10, 2013, 12:21 p.m.
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.

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;