This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bit manipulation on PowerPC


<mwilliams@ase-tech-usa.com> writes:

> Symptoms:
> When optimization is enabled, a bit manipulation expression compiles to
> incorrect assembly code.  Given the value 0x00010001, the expression should
> produce 0x00000101.  The assembly code produces 0x00000100.  The bug
> appears to occur only when the expression is evaluated in place (i.e. using
> a single register).
> 
> Version:
> Reading specs from
> C:\Tornado\host\x86-win32\lib\gcc-lib\powerpc-wrs-vxworks\cygnus-2.7.2-9601
> 26\specs
> gcc driver version cygnus-2.7.2-960126 egcs-971225 tornado 2.0 executing
> gcc version cygnus-2.7.2-960126
> 
> System:
> Pentium III host running Windows 98, targeting embedded PowerPC 403 system
> running VxWorks 5.4
> 
> Command line:
> gcc --save-temps -S -O1 bah.c
> 
> File:
> # 1 "bah.c"
> unsigned long f(unsigned long x)
> {
>   return ((x&0x003f0000)>>8)|(x&0x0000003f);
> }

This is fixed in current compilers.  You should upgrade, if you can.

-- 
- Geoffrey Keating <geoffk@geoffk.org>

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]