In a private arm based target on gcc 4.1.1 I noticed that the sp stack value is
wrong after having called __floatdidf or __floatundidf (at
gcc/config/arm/ieee754-df.S).

The reason is that for this target I don't have __VFP_FP__ nor __SOFTFP__
defined which means that both routines will finally call f0_ret.  The final
return statement is the macro RETLDM which is defined as 'ldr pc, [sp], #8' and
this is increasing the stack pointer with 4 too much as at that time the r4, r5
and ip of 'stmfd sp!, {r4, r5, ip, lr}' on entry of those routines are
consumed, so sp may only increase by 4, not 8.

The easy fix I did was:

--- gcc/config/arm/ieee754-df.S.orig    2006-12-13 02:54:07.000000000 +0100
+++ gcc/config/arm/ieee754-df.S 2006-12-13 02:53:40.000000000 +0100
@@ -528,7 +528,7 @@
 LSYM(f0_ret):
        stmfd   sp!, {r0, r1}
        ldfd    f0, [sp], #8
-       RETLDM
+       ldr     pc, [sp], #4

 #endif


-- 
           Summary: [arm] Wrong sp value on exit after calling __floatdidf
                    or __floatundidf
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: John dot Tytgat at aaug dot net
GCC target triplet: arm-unknown-riscos


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30192

Reply via email to