public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c, c++: Fix up excess precision handling of scalar_to_vector conversion [PR107358]
Date: Mon, 24 Oct 2022 09:23:43 -0600	[thread overview]
Message-ID: <29e4fb33-2fd9-0e39-4a6e-64208adea45e@gmail.com> (raw)
In-Reply-To: <Y1Y8dfwmYoaac6EW@tucnak>


On 10/24/22 01:19, Jakub Jelinek via Gcc-patches wrote:
> Hi!
>
> As mentioned earlier in the C++ excess precision support mail, the following
> testcase is broken with excess precision both in C and C++ (though just in C++
> it was triggered in real-world code).
> scalar_to_vector is called in both FEs after the excess precision promotions
> (or stripping of EXCESS_PRECISION_EXPR), so we can then get invalid
> diagnostics that say float vector + float involves truncation (on ia32
> from long double to float).
>
> The following patch fixes that by calling scalar_to_vector on the operands
> before the excess precision promotions, let scalar_to_vector just do the
> diagnostics (it does e.g. fold_for_warn so it will fold
> EXCESS_PRECISION_EXPR around REAL_CST to constants etc.) but will then
> do the actual conversions using the excess precision promoted operands
> (so say if we have vector double + (float + float) we don't actually do
> vector double + (float) ((long double) float + (long double) float)
> but
> vector double + (double) ((long double) float + (long double) float)
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2022-10-24  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR c++/107358
> c/
> 	* c-typeck.cc (build_binary_op): Pass operands before excess precision
> 	promotions to scalar_to_vector call.
> cp/
> 	* typeck.cc (cp_build_binary_op): Pass operands before excess precision
> 	promotions to scalar_to_vector call.
> testsuite/
> 	* c-c++-common/pr107358.c: New test.
> 	* g++.dg/cpp1y/pr68180.C: Remove -fexcess-precision=fast from
> 	dg-options.

OK

jeff



  reply	other threads:[~2022-10-24 15:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24  7:19 Jakub Jelinek
2022-10-24 15:23 ` Jeff Law [this message]
2022-10-24 20:03 ` Jason Merrill

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=29e4fb33-2fd9-0e39-4a6e-64208adea45e@gmail.com \
    --to=jeffreyalaw@gmail.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).