This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/28161] Wrong bit field layout with -mms-bitfields
- From: "kkojima at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jun 2006 00:28:22 -0000
- Subject: [Bug middle-end/28161] Wrong bit field layout with -mms-bitfields
- References: <bug-28161-5208@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from kkojima at gcc dot gnu dot org 2006-06-27 00:28 -------
Although I'm also not familiar with these materials, when
place_field is called for a.d, gdb says that
(gdb) call debug_tree (field)
<field_decl 0xb7f494ac d
type <integer_type 0xb7ea63f4 long long int DI
size <integer_cst 0xb7e91510 constant invariant 64>
unit size <integer_cst 0xb7e91528 constant invariant 8>
align 64 symtab 0 alias set -1 precision 64 min <integer_cst 0xb7e914c8
0x8000000000000000> max <integer_cst 0xb7e914e0 0x7fffffffffffffff>>
external nonlocal bit-field nonaddressable decl_3 decl_4 VOID file tiny.cc
line 3
size <integer_cst 0xb7f4b6a8 type <integer_type 0xb7ea605c bit_size_type>
constant invariant 23>
user align 64 offset_align 1 context <record_type 0xb7f49450 S> attributes
<tree_list 0xb7f4b690> chain <field_decl 0xb7f49508 e>>
but when it's called for a.e
(gdb) call debug_tree (rli->prev_field)
<field_decl 0xb7f494ac d
type <integer_type 0xb7f495c0 SI
size <integer_cst 0xb7e913d8 constant invariant 32>
unit size <integer_cst 0xb7e91168 constant invariant 4>
align 32 symtab 0 alias set -1 precision 23 min <integer_cst 0xb7f168b8
-4194304> max <integer_cst 0xb7f4b6d8 4194303>>
external nonlocal bit-field nonaddressable decl_3 decl_4 DI file tiny.cc
line 3
size <integer_cst 0xb7f4b6a8 type <integer_type 0xb7ea605c bit_size_type>
constant invariant 23>
unit size <integer_cst 0xb7e91348 type <integer_type 0xb7ea6000 unsigned
int> constant invariant 3>
user align 64 offset_align 128
offset <integer_cst 0xb7e91180 type <integer_type 0xb7ea6000 unsigned int>
constant invariant 0>
bit offset <integer_cst 0xb7e91930 type <integer_type 0xb7ea605c
bit_size_type> constant invariant 0>
bit_field_type <integer_type 0xb7ea63f4 long long int DI
size <integer_cst 0xb7e91510 constant invariant 64>
unit size <integer_cst 0xb7e91528 constant invariant 8>
align 64 symtab 0 alias set -1 precision 64 min <integer_cst 0xb7e914c8
0x8000000000000000> max <integer_cst 0xb7e914e0 0x7fffffffffffffff>> context
<record_type 0xb7f49450 S> attributes <tree_list 0xb7f4b690> chain <field_decl
0xb7f49508 e>>
i.e. DECL_BIT_FIELD_TYPE is added in processing. I guess that
this is the reason for the use of TREE_TYPE (field) for not yet
processed fields and non ms-bitfield case. gcc allocates 32-bit
for a.d without -mms-bitfield. OTOH, ms-bitfield code see
the previous and already processed field and should allocate
64-bit for a.d.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28161