egcs-1.1.2 on SH1: miscompiles function

Toshiyasu Morita tm@netcom.com
Fri Apr 23 11:48:00 GMT 1999


> Hi,
> 
> egcs-1.1.2 create wrong code cross-compiling for SH-1 target. 
> (Host: Win NT4.0 i586)
...

> Any idea whats going wrong ?
> 
> Thanks,
> Hartmut

If I remember correctly there is a known bug in regmove in egcs-1.1.2.
You might try compiling with -fno-regmove and see if the problem disappears.

The code generated by egcs-current looks considerably different (and better)
so I'm not sure if the bug occurs:

  35:sh1bug.c      ****         l = stack[s].l;
  98 0054 906C                  mov.w   L44,r0
  99 0056 00FE                  mov.l   @(r0,r15),r0
 100 0058 01FE                  mov.l   @(r0,r15),r1
 101 005a 906A                  mov.w   L45,r0
 102 005c 0F16                  mov.l   r1,@(r0,r15)
  36:sh1bug.c      ****         r = stack[s].r;   /*  bug: r isn't set to 
nel-1 on first loop !! */
 104 005e 9164                  mov.w   L41,r1
 105 0060 7020                  add     #32,r0
 106 0062 00FE                  mov.l   @(r0,r15),r0
 107 0064 31FC                  add     r15,r1
 108 0066 521F                  mov.l   @(60,r1),r2
 109 0068 012E                  mov.l   @(r0,r2),r1
 110 006a 905E                  mov.w   L41,r0

Toshi



More information about the Gcc-bugs mailing list