[gccsdk] [Bug 217] Stack Backtrace with certain programs built with gcc 4.6

bugzilla-daemon at riscos.info bugzilla-daemon at riscos.info
Wed Mar 2 18:12:41 PST 2011


http://www.riscos.info/bugzilla3/show_bug.cgi?id=217

John Tytgat <John.Tytgat at aaug.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #3 from John Tytgat <John.Tytgat at aaug.net> 2011-03-02 18:12:40 PST ---
More minimal test case:

--8<--
#include <math.h>

#include <stdio.h>



float res;


main()

{

  int i;

  float y;              



  y = 0.5;

  for (i = 1; i < 5; i++)
  {
    y = sin (y)*cos (y);
  }

  res = y;
  puts ("ok");

}

--8<--

When compiled with:

arm-unknown-riscos-gcc -static -O1 bug217.c -o bug217,ff8 && elf2aif bug217,ff8

then we have the sin() and cos() calls being optimized to a cexp():

--8<--
main:
    @ args = 0, pretend = 0, frame = 0, outgoing = 0
    @ frame_needed = 1, uses_anonymous_args = 0
    mov    ip, sp
    stmfd    sp!, {r4, r5, r6, fp, ip, lr, pc}
    sub    fp, ip, #4
    cmp    sp, sl
    bllt    __rt_stkovf_split_small
    mov    r6, #4
    mov    r0, #1056964608
.L2:
    bl    __extendsfdf2
    mov    r4, r0
    mov    r5, r1
    mov    r0, #0
    mov    r1, #0
    mov    r2, r4
    mov    r3, r5
    bl    cexp
    mov    r4, r0
    mov    r5, r1
    mov    r0, r2
    mov    r1, r3
    mov    r2, r4
    mov    r3, r5
    bl    __muldf3
    bl    __truncdfsf2
    subs    r6, r6, #1
    bne    .L2
    ldr    r3, .L4
    str    r0, [r3, #0]    @ float
    ldmea    fp, {r4, r5, r6, fp, sp, pc}
--8<--

All very fine so far, but UnixLib's cexp() seems to use r8 which does not get
saved/restored.  Not clear yet if that's the reason for __cexp() -> __sincos()
-> __cexp() loop.

-- 
Configure bugmail: http://www.riscos.info/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.




More information about the gcc mailing list