Structure with bit-field offset is wrong.

Nitin Shah NitinS2@KPITCummins.com
Thu Nov 25 08:42:00 GMT 2004


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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




More information about the Gcc mailing list