TR : Possible GCC bug on m68k

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Tue Nov 2 22:01:19 UTC 2004


Etienne Fortin wrote:
> The one that comes with RTEMS-4.6.1.
> 

That would have been a gcc 3.2 series.  I now have an
example which is pretty simple:

typedef struct {
   unsigned char number;
} pkt;

unsigned int f( int i );
int g( pkt *packet )
{
   unsigned char comp;

   packet->number = (unsigned char)f(1);
   comp = (unsigned char)f(2);
   if (packet->number != ~comp)
      return 1;
   return 0;
}
/* packet->number = 0 and comp = 0xFF. */


I tried it with the latest 4.6.2 tools and my current
gcc 3.3.5 tools for 4.7 and it shows the same disassembly
at both -02 and -O4.

/opt/rtems-4.7/bin/m68k-rtems4.7-gcc -S -O4 m68k1.c
/opt/rtems-4.6/bin/m68k-rtems-gcc -S -O2 m68k1.c

Does this example match what you think is happening?

--joel



More information about the users mailing list