public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/101062] [10/11/12 Regression] wrong code with "-O2 -fno-toplevel-reorder -frename-registers"
Date: Tue, 15 Jun 2021 07:42:40 +0000	[thread overview]
Message-ID: <bug-101062-4-hTPDtLHmLD@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101062-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101062

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Eric Botcazou from comment #6)
> > Does Ada allow bitfields in unions and if yes, what does it want for those?
> 
> Yes, it does, and I don't think there is any specific need so the default
> should be OK like for structures.

I also think since there's at most a single active union member the default
should work.

Now, it looks to me this is rather an issue that the access is larger than
the object and thus a general bug - at least I don't see how it should only
manifest with bitfields in unions?

Note we do

      if (TREE_CODE (to) == COMPONENT_REF
          && DECL_BIT_FIELD_TYPE (TREE_OPERAND (to, 1)))
        get_bit_range (&bitregion_start, &bitregion_end, to, &bitpos, &offset);
      /* The C++ memory model naturally applies to byte-aligned fields.
         However, if we do not have a DECL_BIT_FIELD_TYPE but BITPOS or
         BITSIZE are not byte-aligned, there is no need to limit the range
         we can access.  This can occur with packed structures in Ada.  */
      else if (maybe_gt (bitsize, 0)
               && multiple_p (bitsize, BITS_PER_UNIT)
               && multiple_p (bitpos, BITS_PER_UNIT))
        {
          bitregion_start = bitpos;
          bitregion_end = bitpos + bitsize - 1;
        }

but if we assume that for DECL_BIT_FIELD_TYPE there's a representative
then we miss the else if, so - maybe get_bit_range should return whether
it handled things or the else if part should be done unconditionally
in case bitregion_start/end is not {0,0}?

  parent reply	other threads:[~2021-06-15  7:42 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 11:05 [Bug tree-optimization/101062] New: " suochenyao at 163 dot com
2021-06-14 18:04 ` [Bug tree-optimization/101062] [10/11/12 Regression] " jakub at gcc dot gnu.org
2021-06-14 18:08 ` jakub at gcc dot gnu.org
2021-06-14 18:35 ` jakub at gcc dot gnu.org
2021-06-14 18:59 ` jakub at gcc dot gnu.org
2021-06-14 20:20 ` jakub at gcc dot gnu.org
2021-06-14 21:46 ` ebotcazou at gcc dot gnu.org
2021-06-15  7:42 ` rguenth at gcc dot gnu.org [this message]
2021-06-15  8:15 ` jakub at gcc dot gnu.org
2021-06-15  8:56 ` [Bug middle-end/101062] " rguenther at suse dot de
2021-06-15  9:05 ` jakub at gcc dot gnu.org
2021-06-15  9:21 ` rguenth at gcc dot gnu.org
2021-06-16 10:18 ` cvs-commit at gcc dot gnu.org
2021-06-17  8:20 ` jakub at gcc dot gnu.org
2021-06-17  8:22 ` jakub at gcc dot gnu.org
2021-06-17  9:13 ` ebotcazou at gcc dot gnu.org
2021-06-18  9:21 ` cvs-commit at gcc dot gnu.org
2021-06-18  9:23 ` cvs-commit at gcc dot gnu.org
2021-06-18  9:23 ` cvs-commit at gcc dot gnu.org
2021-07-13 13:13 ` [Bug middle-end/101062] [10 " jakub at gcc dot gnu.org
2022-05-10  8:18 ` cvs-commit at gcc dot gnu.org
2022-05-10  8:19 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:20 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:20 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:36 ` jakub at gcc dot gnu.org

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=bug-101062-4-hTPDtLHmLD@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).