[Bug target/8309] [3.3/3.4 regression][m68k] m68k-elf-gcc -m5200 produces erroneous SImode set of short varaible on stack

pirovano at logiclab dot it gcc-bugzilla@gcc.gnu.org
Mon Mar 8 15:57:00 GMT 2004


------- Additional Comments From pirovano at logiclab dot it  2004-03-08 15:57 -------
We are using rtems-4.6.0, opt "rtems-4.6" with  GNU gcc compiler 3.2.3 
on MCF5272 target and we encountered again a problem that seems PR 8309. 

This problem is very critical because all the code generated for  coldfire 
family is  unreliable   and to find the cause of possible malfunction is very 
hard. 

Here a short description of we encountered: 

We compile with -O4 -fno-force-mem
and a local variable declared as byte is managed in wrong mode.

Here we show the C-code and the assembler generated by compiler:

pInfo->InfoHw[0].Offset = offset+ p->Reg;
   move.b    -0x0B(a6),d0   ; offset(a6),d0
   move.b    d0,-0x0F(a6)   ; d0,-15(a6)   ;ok <Offset> is a Byte
   move.b    0x1(a2),d6     ; 1(a2),d6
   ext.w     d6
   add.l     -0x10(a6),d6    ;add.w doesn't exist in coldfire 
   move.w    d6,0x6(a1)      ;and using add.l it gets values
                             ;stored from -0x10(a6) to  -0x0d(a6) 


If we change the declaration of the local variable <offset>, from byte to 
short, the code becomes:

pInfo->InfoHw[0].Offset = offset+p->Reg
          move.b    0x1(a2),d7     ; 1(a2),d7
          ext.w     d7
          add.l     a5,d7          ; offset,d7
          move.w    d7,0x6(a1)     ; d7,EXTENDSFDF(a1)

In this case compiler uses a register for the local variable <offset> and then 
the problem disappear.



-- 


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



More information about the Gcc-bugs mailing list