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]

Re: [ARM] Fix unaligned accessed generated when using -mthumb -mtpcs-frame

Richard Earnshaw wrote:

On Sat, 2005-05-21 at 21:00, Khem Raj wrote:


This patch was hinted by Daniel Jacobowitz offline.
The following patch fixes the unaligned stores generated when using -mthumb -mtpcs-frame options for compiling.
The register mask of the register to be stored should have been multiplied by 4 for generating correct offsets. This only
happens when the above mentioned options are used i.e when thumb backtracking is on.

Tested arm-none-eabi on arm-sim/-mthumb/-mtpcs-frame there were mass failures without this patch. The test results are far better with the patch.

This should be UNITS_PER_WORD rather than '4'. Otherwise OK.


Hi Richard,

I have changed the patch to use UNITS_PER_WORD and added changelog entry. I do not have CVS write permissions
can you install the patch if it is ok.



? t.diff
Index: gcc/ChangeLog
RCS file: /cvsroot/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.8874
diff -u -p -r2.8874 ChangeLog
--- gcc/ChangeLog	22 May 2005 07:34:11 -0000	2.8874
+++ gcc/ChangeLog	22 May 2005 20:22:26 -0000
@@ -1,3 +1,8 @@
+2005-05-22  Khem Raj  <>
+	* config/arm/arm.c (thumb_output_function_prologue): Handle
+	unaligned stack offsets when using thumb backtracking.
 2005-05-22  Eric Botcazou  <>
 	* config/sparc/sparc.c (sparc_emit_float_lib_cmp): Use
Index: gcc/config/arm/arm.c
RCS file: /cvsroot/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.460
diff -u -p -r1.460 arm.c
--- gcc/config/arm/arm.c	15 May 2005 18:29:32 -0000	1.460
+++ gcc/config/arm/arm.c	22 May 2005 20:22:26 -0000
@@ -13487,7 +13487,7 @@ thumb_output_function_prologue (FILE *f,
       if (l_mask)
 	  thumb_pushpop (f, l_mask, 1, &cfa_offset, l_mask);
-	  offset = bit_count (l_mask);
+	  offset = bit_count (l_mask) * UNITS_PER_WORD;
 	offset = 0;

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