[coldfire-gnu-discuss] Coldfire Toolchain packed structure bug version 4.1.30 and newer

Malnar, Tom Tom.Malnar at christiedigital.com
Wed Apr 18 21:30:56 UTC 2007


Thank Carlos, I really appreciate the quick follow up.  

I just wanted to mention (may help your investigation) that there may be
two issues.  

The assembly actually produced when the alignment was 1 is very bad.  
I assume when alignment was 1 that my 'short' variable was treated as
two bytes.  To move two bytes, something like:

  moveal %fp@(-4),%a0
  clrl %d0
  moveb %d0,%a0@
  mov3ql #2,%d0
  moveb %d0,%a0@(1)

would do the job.  The code it produced was:

  12:   206e fffc       moveal %fp@(-4),%a0
  16:   1010            moveb %a0@,%d0
  18:   4281            clrl %d1
  1a:   c081            andl %d1,%d0
  1c:   1000            moveb %d0,%d0
  1e:   1080            moveb %d0,%a0@
  20:   1028 0001       moveb %a0@(1),%d0
  24:   4281            clrl %d1
  26:   c081            andl %d1,%d0
  28:   1000            moveb %d0,%d0
  2a:   a541            mov3ql #2,%d1
  2c:   8081            orl %d1,%d0
  2e:   1000            moveb %d0,%d0
  30:   1140 0001       moveb %d0,%a0@(1)
  
Not sure if the issues are related or not, but it should probably be
investigated.  

Thanks again.

-----Original Message-----
From: Carlos O'Donell [mailto:carlos at codesourcery.com] 
Sent: April 18, 2007 12:16 PM
To: Malnar, Tom
Cc: coldfire-gnu-discuss at codesourcery.com; Nathan Sidwell
Subject: Re: [coldfire-gnu-discuss] Coldfire Toolchain packed structure
bug version 4.1.30 and newer

On Tue, Apr 17, 2007 at 02:06:55PM -0400, Malnar, Tom wrote:
>    We recently ugraded our tools to version 4.1.30 for the coldfire
from 3.4.
>    Our processor is a MCF5475VR266.  
>    We noticed a new bug in the assembler code produced when
dereferencing a
>    packed structure.   
> 
>    Does anyone have any suggestions on some things we could try?  Will
this
>    issue be addressed in a future tool chain release?
     
Thank you for using Sourcery G++!

The workaround in this case is to use:
m68k-linux-gnu-gcc -mno-strict-align -g -Wall -c test.c

The "-mno-strict-align" tells the compiler to relax the normal m68k
alignment requirements. The Coldfire hardware (v2/3/4e) support
unaligned loads and store so this should be OK.

We will look into this issue. Thanks!

Cheers,
Carlos.
-- 
Carlos O'Donell
CodeSourcery
carlos at codesourcery.com
(650) 331-3385 x716



More information about the coldfire-gnu-discuss mailing list