This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14786] Struct misaligned containing unsigned char bit-field
- From: "ryanma at cpsc dot ucalgary dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Mar 2004 15:35:49 -0000
- Subject: [Bug c/14786] Struct misaligned containing unsigned char bit-field
- References: <20040330191303.14786.ryanma@cpsc.ucalgary.ca>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From ryanma at cpsc dot ucalgary dot ca 2004-03-31 15:35 -------
http://publib.boulder.ibm.com/infocenter/comphelp/topic/com.ibm.vacpp6a.doc/prog
uide/ref/rvclralg.htm
The xlc compiler exhibits the expected behavior.
$ xlc t.c -qlanglvl=extended
"t.c", line 5.25: 1506-159 (E) Bit-field type specified for a is not valid.
Type unsigned assumed.
"t.c", line 6.25: 1506-159 (E) Bit-field type specified for b is not valid.
Type unsigned assumed.
"t.c", line 7.25: 1506-159 (E) Bit-field type specified for c is not valid.
Type unsigned assumed.
"t.c", line 8.25: 1506-159 (E) Bit-field type specified for d is not valid.
Type unsigned assumed.
"t.c", line 9.25: 1506-159 (E) Bit-field type specified for e is not valid.
Type unsigned assumed.
"t.c", line 10.25: 1506-159 (E) Bit-field type specified for f is not valid.
Type unsigned assumed.
"t.c", line 11.25: 1506-159 (E) Bit-field type specified for g is not valid.
Type unsigned assumed.
"t.c", line 12.25: 1506-159 (E) Bit-field type specified for h is not valid.
Type unsigned assumed.
"t.c", line 13.25: 1506-159 (E) Bit-field type specified for i is not valid.
Type unsigned assumed.
"t.c", line 14.25: 1506-159 (E) Bit-field type specified for J is not valid.
Type unsigned assumed.
"t.c", line 15.25: 1506-159 (E) Bit-field type specified for K is not valid.
Type unsigned assumed.
./a.out
$ ./a.out
Address of Struct =2ff22a20
sizeof(SubStruct) =4
sizeof(Struct) =20
offset of B =8
offset of C =12
offset of D =13
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14786