From: Richard Biener <richard.guenther@gmail.com>
To: Eric Botcazou <botcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix handling of non-integral bit-fields in native_encode_initializer
Date: Mon, 22 May 2023 14:15:40 +0200 [thread overview]
Message-ID: <CAFiYyc09bg9=Yain1TE3Ny829_E8Rg0Qve5csBJw8V=QMNV7MQ@mail.gmail.com> (raw)
In-Reply-To: <13270277.uLZWGnKmhe@fomalhaut>
On Mon, May 22, 2023 at 10:10 AM Eric Botcazou via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> Hi,
>
> the encoder for CONSTRUCTORs assumes that all bit-fields (DECL_BIT_FIELD) have
> integral types, but that's not the case in Ada where they may have pretty much
> any type, resulting in a wrong encoding for them.
>
> The attached fix filters out non-integral bit-fields, except if they start and
> end on a byte boundary because they are correctly handled in this case.
>
> Bootstrapped/regtested on x86-64/Linux, OK for mainline and 13 branch?
OK.
Can we handle non-integer bitfields by recursing with a temporary buffer to
encode it byte-aligned and then apply shifting and masking to get it in place?
Or is that not worth it?
Thanks,
Richard.
>
>
> 2023-05-22 Eric Botcazou <ebotcazou@adacore.com>
>
> * fold-const.cc (native_encode_initializer) <CONSTRUCTOR>: Apply the
> specific treatment for bit-fields only if they have an integral type
> and filter out non-integral bit-fields that do not start and end on
> a byte boundary.
>
>
> 2023-05-22 Eric Botcazou <ebotcazou@adacore.com>
>
> * gnat.dg/opt101.adb: New test.
> * gnat.dg/opt101_pkg.ads: New helper.
>
> --
> Eric Botcazou
next prev parent reply other threads:[~2023-05-22 12:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-22 8:08 Eric Botcazou
2023-05-22 12:15 ` Richard Biener [this message]
2023-05-23 8:09 ` 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='CAFiYyc09bg9=Yain1TE3Ny829_E8Rg0Qve5csBJw8V=QMNV7MQ@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=botcazou@adacore.com \
--cc=gcc-patches@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).