From: Richard Guenther <richard.guenther@gmail.com>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: Michael Matz <matz@suse.de>, gcc@gcc.gnu.org
Subject: Re: Do BLKmode bit-fields still exist?
Date: Fri, 06 Nov 2009 09:54:00 -0000 [thread overview]
Message-ID: <84fc9c000911060153m4fbd86efqaa823c71d15543b6@mail.gmail.com> (raw)
In-Reply-To: <200911061046.50176.ebotcazou@adacore.com>
On Fri, Nov 6, 2009 at 10:46 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> 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.
Isn't it enough to specify DECL_PACKED here? The tree.h docs
about DECL_BIT_FIELD are a bit unspecific compared to
DECL_PACKED.
/* Nonzero in a FIELD_DECL means it is a bit field, and must be
accessed specially. */
vs.
/* In a FIELD_DECL, indicates this field should be bit-packed. */
where it seems, as your field isn't a bitfield, using DECL_PACKED
looks more appropriate?
Richard.
> --
> Eric Botcazou
>
next prev parent reply other threads:[~2009-11-06 9:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-05 17:03 Michael Matz
2009-11-05 17:42 ` Jeff Law
2009-11-06 9:47 ` Eric Botcazou
2009-11-06 9:54 ` Richard Guenther [this message]
2009-11-06 11:29 ` Eric Botcazou
2009-11-06 16:24 ` Michael Matz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84fc9c000911060153m4fbd86efqaa823c71d15543b6@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=ebotcazou@adacore.com \
--cc=gcc@gcc.gnu.org \
--cc=matz@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).