public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Bernd Schmidt <bernds@codesourcery.com>,
	Richard Earnshaw <rearnsha@arm.com>
Cc: Richard Guenther <richard.guenther@gmail.com>,
	Joey Ye <Joey.Ye@arm.com>, "dj\@redhat.com" <dj@redhat.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>, "Mitchell\,
	Mark" <mark_mitchell@mentor.com>
Subject: Re: Continue strict-volatile-bitfields fixes
Date: Thu, 19 Apr 2012 17:46:00 -0000	[thread overview]
Message-ID: <871unjobrq.fsf@schwinge.name> (raw)
In-Reply-To: <4F8EE8E0.6020907@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 2284 bytes --]

Hi!

On Wed, 18 Apr 2012 18:16:32 +0200, Bernd Schmidt <bernds@codesourcery.com> wrote:
> On 04/18/2012 06:14 PM, Richard Earnshaw wrote:
> > On 18/04/12 16:37, Thomas Schwinge wrote:
> >> gcc/testsuite/
> >> 	* gcc.dg/tree-ssa/20030922-1.c: Compile with
> >> 	-fno-strict-volatile-bitfields.
> >> 	* gcc.dg/tree-ssa/foldconst-3.c: Likewise.
> >> 	* gcc.dg/tree-ssa/vrp15.c: Likewise.
> >>
> > 
> > None of these have any volatile bitfields, so the option should be a no-op.

That's what I thought, too.  :-)

> The problem is that we have to treat normal bitfields differently as
> well, since a variable may later be declared as volatile.

Here is my current test case, reduced from gcc.dg/tree-ssa/20030922-1.c:

    extern void abort (void);
    
    enum tree_code
    {
      BIND_EXPR,
    };
    struct tree_common
    {
      enum tree_code code:8;
    };
    void
    voidify_wrapper_expr (struct tree_common *common)
    {
      switch (common->code)
        {
        case BIND_EXPR:
          if (common->code != BIND_EXPR)
            abort ();
        }
    }

The diff for -fdump-tree-all between compiling with
-fno-strict-volatile-bitfields and -fstrict-volatile-bitfields begins
with the following, right in 20030922-1.c.003t.original:

diff -ru fnsvb/20030922-1.c.003t.original fsvb/20030922-1.c.003t.original
--- fnsvb/20030922-1.c.003t.original    2012-04-19 16:51:18.322150866 +0200
+++ fsvb/20030922-1.c.003t.original     2012-04-19 16:49:18.132088498 +0200
@@ -7,7 +7,7 @@
   switch ((int) common->code)
     {
       case 0:;
-      if (common->code != 0)
+      if ((BIT_FIELD_REF <*common, 32, 0> & 255) != 0)
         {
           abort ();
         }

That is, for -fno-strict-volatile-bitfields the second instance of
»common->code« it is a component_ref, whereas for
-fstrict-volatile-bitfields it is a bit_field_ref.  The former will be
optimized as intended, the latter will not.  So, what should be emitted
in the -fstrict-volatile-bitfields case?  A component_ref -- but this is
what Bernd's commit r182545 (for PR51200) changed, I think?  Or should
later optimization stages learn to better deal with a bit_field_ref, and
where would this have to happen?


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]

  reply	other threads:[~2012-04-19 17:46 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <000801cca086$dcd59b30$9680d190$@ye@arm.com>
2011-11-11 16:36 ` Bernd Schmidt
2011-11-13 23:04   ` Mitchell, Mark
2011-11-18  9:37     ` Ye Joey
2011-11-29 17:49   ` Bernd Schmidt
2011-11-29 17:50     ` Mitchell, Mark
     [not found]       ` <CAL0py27kq++qcTGhvqp2Re5bW3ZqkOA95EMnmZfHTEr-LdpMcw@mail.gmail.com>
2011-12-15  8:06         ` Ye Joey
2011-12-20 16:52       ` Bernd Schmidt
2011-12-21  3:59         ` Ye Joey
2011-12-21  4:22         ` Ye Joey
2012-01-23 14:46       ` Bernd Schmidt
2012-01-23 19:51         ` DJ Delorie
2012-01-23 22:08           ` Bernd Schmidt
2012-02-17 20:57         ` Thomas Schwinge
2012-02-20 14:19           ` Richard Guenther
2012-02-20 17:39             ` Bernd Schmidt
2012-02-20 18:10               ` Richard Earnshaw
2012-02-20 18:18                 ` Bernd Schmidt
2012-02-21  9:45                   ` Richard Earnshaw
2012-04-18 15:38                     ` Thomas Schwinge
2012-04-18 16:16                       ` Richard Earnshaw
2012-04-18 16:19                         ` Bernd Schmidt
2012-04-19 17:46                           ` Thomas Schwinge [this message]
2012-04-19 17:57                             ` -fdump-tree-original, bit_field_ref (was: Continue strict-volatile-bitfields fixes) Thomas Schwinge
2012-04-20  8:29                               ` Richard Guenther
2012-04-20  6:56                             ` Continue strict-volatile-bitfields fixes Joey Ye
2012-04-25 11:28                             ` Thomas Schwinge
2012-04-25 11:51                               ` Richard Guenther
2012-04-27  4:43                                 ` Thomas Schwinge
2012-04-27  8:29                                   ` Jakub Jelinek
2012-04-27  9:00                                     ` Richard Guenther
2012-04-27  9:05                                       ` Jakub Jelinek
2012-05-09  2:02                                     ` Thomas Schwinge
2012-05-16 17:15                                       ` Thomas Schwinge
2012-05-24 12:29                                         ` Thomas Schwinge
2012-05-24 12:38                                           ` Jakub Jelinek

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=871unjobrq.fsf@schwinge.name \
    --to=thomas@codesourcery.com \
    --cc=Joey.Ye@arm.com \
    --cc=bernds@codesourcery.com \
    --cc=dj@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mark_mitchell@mentor.com \
    --cc=rearnsha@arm.com \
    --cc=richard.guenther@gmail.com \
    /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).