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]
Other format: [Raw text]

[Bug c/18671] New: Structure with bit-field offset is wrong.


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


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