This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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?


 	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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]