public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: Richard Guenther <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix PRs 52080, 52097 and 48124, rewrite bitfield expansion, enable the C++ memory model wrt bitfields everywhere
Date: Thu, 15 Mar 2012 16:19:00 -0000	[thread overview]
Message-ID: <201203151719.11650.ebotcazou@adacore.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1203151621270.27160@zhemvz.fhfr.qr>

> 1. is easy, see patch below.  2. is much harder - we need to
> compute the bit-offset relative to the bitfield group start,
> thus in get_bit_range we do
>
>   /* Compute the adjustment to bitpos from the offset of the field
>      relative to the representative.  */
>   offset = size_diffop (DECL_FIELD_OFFSET (field),
>                         DECL_FIELD_OFFSET (repr));
>   bitoffset = (tree_low_cst (offset, 1) * BITS_PER_UNIT
>                + tree_low_cst (DECL_FIELD_BIT_OFFSET (field), 1)
>                - tree_low_cst (DECL_FIELD_BIT_OFFSET (repr), 1));
>
> and we cannot generally assume offset is zero (well, maybe we could
> arrange that though, at least we could assert that for all fields
> in a bitfield group DECL_FIELD_OFFSET is the same?).

I'm skeptical.

> Any suggestion?  Apart from trying to make sure that offset will
> be zero by construction?  Or by simply not handling bitfields
> properly that start at a variable offset?

Computing the offset in stor-layout.c and storing it in DECL_INITIAL?

> The finish_bitfield_representative hunk implements the fix for 1.,
> the rest the proposed zero-by-construction solution for 2.

Thanks!

-- 
Eric Botcazou

  reply	other threads:[~2012-03-15 16:19 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05 13:26 Richard Guenther
2012-03-09  9:02 ` Eric Botcazou
2012-03-12  9:38   ` Richard Guenther
2012-03-12 10:21     ` Eric Botcazou
2012-03-13 14:19       ` Richard Guenther
2012-03-15 14:43         ` Eric Botcazou
2012-03-15 14:58           ` Richard Guenther
2012-03-15 15:30             ` Richard Guenther
2012-03-15 16:19               ` Eric Botcazou [this message]
2012-03-15 17:03                 ` Eric Botcazou
2012-03-16  9:42                   ` Richard Guenther
2012-03-19 10:45                     ` Eric Botcazou
2012-03-19 13:14                       ` Richard Guenther
2012-03-20  9:30                         ` Richard Guenther
2012-03-22 10:26                           ` Eric Botcazou
2012-03-22 10:38                             ` Richard Guenther
2012-03-22 11:13                               ` Eric Botcazou
2012-03-22 11:22                                 ` Richard Guenther
2012-03-22 11:48                                   ` Eric Botcazou
2012-03-22 12:04                                     ` Richard Guenther
2012-03-22 12:18                                       ` Eric Botcazou
2012-03-22 12:39                                         ` Richard Guenther
2012-03-23  9:13                                           ` Richard Guenther
2012-03-26  7:18                                             ` Eric Botcazou
2012-03-26  7:37                                               ` Richard Guenther
2012-03-26  7:43                                                 ` Eric Botcazou
2012-03-26  8:01                                                   ` Richard Guenther
2012-03-26  8:18                                                     ` Eric Botcazou
2012-03-26  8:34                                                       ` Richard Guenther
2012-03-26 17:54                                                         ` Eric Botcazou
2012-03-27  6:51                                                           ` Richard Guenther
2012-03-27  7:08                                                             ` Eric Botcazou
2012-03-27  7:50                                                               ` Richard Guenther
2012-03-27  8:39                                                                 ` Eric Botcazou
2012-03-27  8:47                                                                   ` Richard Guenther
2012-03-30 20:58                                                                     ` Eric Botcazou
2012-04-02 14:23                                                                       ` Richard Guenther
2012-04-03  8:26                                                                         ` Eric Botcazou
2012-04-03  8:34                                                                           ` Richard Guenther
2012-04-03 11:09                                                                             ` Eric Botcazou
2012-04-03 11:44                                                                               ` Richard Guenther
2012-03-26  8:10                                                   ` Eric Botcazou
2012-03-26  8:52                                                     ` Richard Guenther
2012-03-26 18:04                                                       ` Eric Botcazou
2012-03-27  6:51                                                         ` Richard Guenther
2012-03-26  7:18                                           ` Eric Botcazou

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=201203151719.11650.ebotcazou@adacore.com \
    --to=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@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).