From: Michael Matz <matz@suse.de>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: gcc@gcc.gnu.org
Subject: Re: Do BLKmode bit-fields still exist?
Date: Fri, 06 Nov 2009 16:24:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.0911061618520.15566@wotan.suse.de> (raw)
In-Reply-To: <200911061046.50176.ebotcazou@adacore.com>
Hi,
On Fri, 6 Nov 2009, Eric Botcazou wrote:
> 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
> external packed bit-field BLK file p.ads line 11 col 5 size <integer_cst
>
> We set DECL_BIT_FIELD in the front-end because the field is misaligned.
Uahhh! A bitfield of RECORD_TYPE! Marvelous.
Molding this into a testcase that actually writes into some parts, like:
procedure Fields is
type Rec1 is record
I1 : Integer;
end record;
type R2 is record
B : Boolean;
R : Rec1;
end record;
pragma Pack (R2);
r,rr : R2;
subr,subr2 : Rec1;
procedure useme (x:in out R2;y:in out Rec1);
pragma Import (C, useme);
function giveme return Integer;
pragma Import (c,giveme);
begin
subr2.I1 := giveme;
subr := subr2;
r.R := subr2;
rr := r;
useme(rr, subr);
end;
triggers the gcc_unreachable in get_inner_references (on sparc), okay.
But I can't trigger the one in store_field, because the target for these
stores will alway be a non-register due to the unaligned fields in there,
hmm. (the above needs -O1 -fno-tree-ccp -fno-tree-copy-prop -fno-tree-sra
ot not forward the giveme() result but retain the store into r.R).
Ciao,
Michael.
prev parent reply other threads:[~2009-11-06 16:24 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
2009-11-06 11:29 ` Eric Botcazou
2009-11-06 16:24 ` Michael Matz [this message]
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=Pine.LNX.4.64.0911061618520.15566@wotan.suse.de \
--to=matz@suse.de \
--cc=ebotcazou@adacore.com \
--cc=gcc@gcc.gnu.org \
/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).