This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Do BLKmode bit-fields still exist?
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 6 Nov 2009 10:46:49 +0100
- Subject: Re: Do BLKmode bit-fields still exist?
- References: <Pine.LNX.4.64.0911051725440.15566@wotan.suse.de>
> In a desparate try to get some testcases which do have BLKmode bit-fields
> I bootstrapped and regtested the below patch (as part of a larger patch,
> though) on seven architectures with all languages (on two without Ada).
Yet it's easy in Ada on platforms with strict alignment, e.g. SPARC:
package P is
type Rec1 is record
I1 : Integer;
I2 : Integer;
I3 : Integer;
end record;
type R2 is record
B : Boolean;
R : Rec1;
end record;
pragma Pack (R2);
end P;
(gdb) p debug_tree(0x2aaaaab2bdc0)
<field_decl 0x2aaaaab2bdc0 r
type <record_type 0x2aaaaabc64d0 p__rec1 sizes-gimplified visited BLK
size <integer_cst 0x2aaaaab27f90 constant visited 96>
unit size <integer_cst 0x2aaaaabd7d20 constant visited 12>
align 32 symtab 0 alias set -1 canonical type 0x2aaaaabc64d0
fields <field_decl 0x2aaaaab2bb40 i1 type <integer_type 0x2aaaaabc6580
integer>
nonaddressable SI file p.ads line 4 col 5
size <integer_cst 0x2aaaaaaf1420 constant visited 32>
unit size <integer_cst 0x2aaaaaaf1090 constant visited 4>
align 32 offset_align 64
offset <integer_cst 0x2aaaaaaf1b40 constant visited 0>
bit offset <integer_cst 0x2aaaaaaf1b70 constant 0> context
<record_type 0x2aaaaabc64d0 p__rec1> chain <field_decl 0x2aaaaab2bbe0 i2>>
Ada size <integer_cst 0x2aaaaab27f90 96>
reference_to_this <reference_type 0x2aaaaabc6630> chain <type_decl
0x2aaaaab34540 p__rec1>>
external packed bit-field BLK file p.ads line 11 col 5 size <integer_cst
0x2aaaaab27f90 96> unit size <integer_cst 0x2aaaaabd7d20 12>
align 8 offset_align 64 offset <integer_cst 0x2aaaaaaf1b40 0>
bit offset <integer_cst 0x2aaaaaaf1180 type <integer_type 0x2aaaaab010b0
bit_size_type> constant visited 8> bit_field_type <record_type 0x2aaaaabc64d0
p__rec1> context <record_type 0x2aaaaabc6790 p__r2>>
We set DECL_BIT_FIELD in the front-end because the field is misaligned.
--
Eric Botcazou