From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11449 invoked by alias); 25 Nov 2004 07:52:35 -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 11411 invoked by uid 48); 25 Nov 2004 07:52:31 -0000 Date: Thu, 25 Nov 2004 07:52:00 -0000 From: "nitins2 at kpitcummins dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20041125075229.18671.nitins2@kpitcummins.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/18671] New: Structure with bit-field offset is wrong. X-Bugzilla-Reason: CC X-SW-Source: 2004-11/txt/msg03035.txt.bz2 List-Id: Hi, I am using tool chain built with gcc-3.4-20040813 snapshot. The structure offset byte is wrong for the following C-source code with "- mrenesas" option. Without "-mrenesas" option it gives correct offset that is 4. The data "b2" of structure "bbb" offset is comming 8 which is wrong, it should be 4. ******************************test.c*************************** struct aaa{ int a1; }*zzz; struct bbb { int b1:1; int b2; }; test(){ ((struct bbb*)zzz)->b2 = 0x12345678; } ************************Command line ************************** sh-elf-gcc -mrenesas -S test.c ***********************test.s********************************** _test: mov.l r14,@-r15 mov r15,r14 mov.l .L2,r1 mov.l @r1,r2 mov.l .L3,r1 mov.l r1,@(8,r2) <-WRONG OFFSET mov r14,r15 mov.l @r15+,r14 rts nop *************************************************************** Kindly suggest how to solve this bug. Thanks in advance. Nitin Shah, KPIT Cummins InfoSystems Ltd. Pune, India ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Free download of GNU based tool-chains for Renesas' SH and H8 Series. The following site also offers free technical support to its users. Visit http://www.kpitgnutools.com for details. Latest versions of KPIT GNU tools are released on October 1, 2004. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Summary: Structure with bit-field offset is wrong. Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: critical Priority: P1 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nitins2 at kpitcummins dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: sh-unknown-elf/sh-unknown-coff http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18671