------- Comment #6 from rearnsha at gcc dot gnu dot org 2009-03-25 21:54 ------- (In reply to comment #2) > str r3, [fp, #-32] > str r4, [fp, #-28] > ldfd f0, [fp, #-32] > sqtd f0, f0 > stfd f0, [fp, #-40] > ldfd f0, [fp, #-40] > ldfd f0, [fp, #-40] > cmf f0, f0 > beq .L2 <============ > sub r0, fp, #32 > ldmia r0, {r0-r1} > bl sqrt > stfd f0, [fp, #-40]
You need to understand what this code is doing to work out the source of the bug. The compiler is inlining a copy of the square-root function with an FPA co-processor instruction sqtd f0, f0 which, if successful will replace the library call. If the square root succeeds it will not return a NaN, so the comparison of the result cmf f0, f0 will be that the two results are equal (a NaN never compares equal to itself). So the square root function (sqrt) will only be called if a NaN was generated by the machine instruction; it does this in order to set errno. Of course, the ARM9 does not have an FPA co-processor so the original sqtd instruction will be emulated by your operating system -- I strongly suspect that that is what is generating the incorrect results and you now need to investigate why. If you still believe the bug is in the compiler you need to provide some additional information, including how you configured the compiler and what options you used when compiling your code. -- rearnsha at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rearnsha at gcc dot gnu dot | |org Status|WAITING |RESOLVED Resolution| |INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39085