public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch] Fix wrong code for return of small aggregates on big-endian
Date: Mon, 09 Jan 2017 11:14:00 -0000	[thread overview]
Message-ID: <CAFiYyc3QvRPOdKjdt8t4PgR1H6ZbLXnpPBx22RJ2M+iqP3db8A@mail.gmail.com> (raw)
In-Reply-To: <22150809.kPoQm0lI1j@polaris>

On Mon, Jan 9, 2017 at 11:43 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this is a regression present on all active branches for big-endian targets
> returning small aggregate types in registers under certain circumstances and
> when optimization is enabled: when the bitfield path of store_field is taken,
> the function ends up calling store_bit_field to store the value.  Now the
> behavior of store_bit_field is awkward when the mode is BLKmode: it always
> takes its value from the lsb up to the word size but expects it left justified
> beyond it (see expmed.c:890 and below) and I missed that when I got rid of the
> stack temporaries that were originally generated in that case.
>
> Of course that's OK for little-endian targets but not for big-endian targets,
> and I have a couple of C++ testcases exposing the issue on SPARC 64-bit and a
> couple of Ada testcases exposing the issue on PowerPC with the SVR4 ABI (the
> Linux ABI is immune since it always returns on the stack); I think they cover
> all the cases in the problematic code.
>
> The attached fix was tested on a bunch of platforms: x86/Linux, x86-64/Linux,
> PowerPC/Linux, PowerPC64/Linux, PowerPC/VxWorks, Aarch64/Linux, SPARC/Solaris
> and SPARC64/Solaris with no regressions.  OK for the mainline? other branches?

Ok for trunk and branches after a short burn-in.

Thanks,
Richard.

>
> 2017-01-09  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * expr.c (store_field): In the bitfield case, if the value comes from
>         a function call and is of an aggregate type returned in registers, do
>         not modify the field mode; extract the value in all cases if the mode
>         is BLKmode and the size is not larger than a word.
>
>
> 2017-01-09  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * g++.dg/opt/call2.C: New test.
>         * g++.dg/opt/call3.C: Likewise.
>         * gnat.dg/array26.adb: New test.
>         * gnat.dg/array26_pkg.ad[sb]: New helper.
>         * gnat.dg/array27.adb: New test.
>         * gnat.dg/array27_pkg.ad[sb]: New helper.
>         * gnat.dg/array28.adb: New test.
>         * gnat.dg/array28_pkg.ad[sb]: New helper.
>
> --
> Eric Botcazou

  reply	other threads:[~2017-01-09 11:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 10:46 Eric Botcazou
2017-01-09 11:14 ` Richard Biener [this message]
2017-01-10  8:01   ` Christophe Lyon
2017-01-10  8:58     ` Eric Botcazou
2017-01-10 10:20       ` Christophe Lyon
2017-01-10 10:27         ` Eric Botcazou
2017-01-10 11:09           ` Christophe Lyon
2017-01-10 12:14         ` Eric Botcazou
2017-01-10 23:06     ` 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=CAFiYyc3QvRPOdKjdt8t4PgR1H6ZbLXnpPBx22RJ2M+iqP3db8A@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=ebotcazou@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).