From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23129 invoked by alias); 14 Jan 2005 18:19:47 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23054 invoked by uid 48); 14 Jan 2005 18:19:42 -0000 Date: Fri, 14 Jan 2005 18:19:00 -0000 From: "yanliu at ca dot ibm dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20050114181939.19448.yanliu@ca.ibm.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/19448] New: Different value representation for bitfield width exceeding its type size. X-Bugzilla-Reason: CC X-SW-Source: 2005-01/txt/msg01846.txt.bz2 List-Id: 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