The gcc compiler information: 
Reading specs from /usr/lib/gcc/ppc64-redhat-linux/3.4.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-
checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-
exceptions --enable-languages=c,c++,objc,java,f77 --enable-java-awt=gtk --
host=ppc64-redhat-linux --build=ppc64-redhat-linux --target=ppc64-redhat-linux -
-with-cpu=default32
Thread model: posix
gcc version 3.4.3 20041125 (Red Hat 3.4.3-6.EL4)

In the attached testcase, the bitfield width is bigger than its type size, and 
the bitfield is initialized with a value greater than 127.  

When c1.m1 is assigned with different value, the result is different using 
g++3.4.3 and g++ 4.0.0 compilers:

c1.m1=128, g++ 3.4.3's result: 128, g++ 4.0.0's result: -128.
c1.m1=400, g++ 3.4.3's result: 144, g++ 4.0.0's result: -112.
c1.m1=500, g++ 3.4.3's result: 244, g++ 4.0.0's result: -12.

Could you tell me which compiler version gives the correct result, and why?

-- 
           Summary: Different value representation for bitfield width
                    exceeding its type size.
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yanliu at ca dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to