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

Khem Raj kraj@mvista.com
Sat May 21 21:50:00 GMT 2005


Hi

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.

Thanks

Khem

Index: arm.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.460
diff -u -r1.460 arm.c
--- arm.c       15 May 2005 18:29:32 -0000      1.460
+++ arm.c       21 May 2005 19:47:09 -0000
@@ -13487,7 +13487,7 @@
       if (l_mask)
        {
          thumb_pushpop (f, l_mask, 1, &cfa_offset, l_mask);
-         offset = bit_count (l_mask);
+         offset = bit_count (l_mask) * 4;
        }
       else
        offset = 0;



More information about the Gcc-patches mailing list