Optimizer problem

42Bastian list-bastian.schick at sciopta.com
Tue Jul 7 15:57:33 UTC 2009


Hi,

following code:

typedef volatile unsigned long __vu32;
void bs()
{

  {
    extern void irq_handler(void);
    int i;
    __vu32 *tbl = (__vu32 *)0xffffff00;
    for(i = 0; i < 64; ++i){
      *tbl++ = (__vu32)irq_handler;
    }
  }
}

compiles to an endless loop if -Os is given:

        .type   bs, @function
bs:
        move.w #-256,%a0
        link.w %fp,#0
.L2:
        move.l #irq_handler,(%a0)+
        jra .L2
        .size   bs, .-bs
        .ident  "GCC: (Sourcery G++ Lite 4.3-54) 4.3.2"

Replacing __vu32 with unsigned long gives correct code.
(BTW: Test with ARM, same effect).

Am I doing something wrong here ??

-- 
42Bastian



More information about the coldfire-gnu-discuss mailing list