public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR middle-end/82319] Fix ICE in pattern
@ 2017-09-27  5:56 Yuri Gribov
  2017-09-27  6:01 ` Andrew Pinski
  0 siblings, 1 reply; 4+ messages in thread
From: Yuri Gribov @ 2017-09-27  5:56 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Biener, Martin Liška

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

Hi all,

This patch fixes a trivial ICE in recent pattern.  Bootstrapped and
regtested on x86_64.

Ok to commit?

-Y

[-- Attachment #2: pr82319-1.patch --]
[-- Type: application/octet-stream, Size: 1546 bytes --]

From 69ec890ed9d40d1111497a7af53a00f13f924f0f Mon Sep 17 00:00:00 2001
From: Yury Gribov <tetra2005@gmail.com>
Date: Wed, 27 Sep 2017 07:33:01 +0200
Subject: [PATCH] 2017-09-27  Yury Gribov  <tetra2005@gmail.com>

	PR middle-end/82319
	* match.pd: Fix handling of NaNs in pattern.
---
 gcc/match.pd                           |  2 +-
 gcc/testsuite/c-c++-common/pr57371-4.c | 12 ++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gcc/match.pd b/gcc/match.pd
index 0863273..560c0c7 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -2949,7 +2949,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 	 else
 	   real_trunc (&icst, fmt, cst);
 
-	 bool cst_int_p = real_identical (&icst, cst);
+	 bool cst_int_p = ! real_isnan (cst) && real_identical (&icst, cst);
 
 	 bool overflow_p = false;
 	 wide_int icst_val
diff --git a/gcc/testsuite/c-c++-common/pr57371-4.c b/gcc/testsuite/c-c++-common/pr57371-4.c
index 6265f52..f43f7c2 100644
--- a/gcc/testsuite/c-c++-common/pr57371-4.c
+++ b/gcc/testsuite/c-c++-common/pr57371-4.c
@@ -69,4 +69,16 @@ void nonfinite(unsigned short x) {
     nonfinite_10 = (float) x != SNAN;
     /* { dg-final { scan-tree-dump "nonfinite_10 = \\(float\\)" "original" } } */
   }
+
+  {
+    volatile int nonfinite_11;
+    nonfinite_11 = (float) x == QNAN;
+    /* { dg-final { scan-tree-dump "nonfinite_11 = 0" "original" } } */
+  }
+
+  {
+    volatile int nonfinite_12;
+    nonfinite_12 = (float) x != QNAN;
+    /* { dg-final { scan-tree-dump "nonfinite_12 = 1" "original" } } */
+  }
 }
-- 
2.9.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR middle-end/82319] Fix ICE in pattern
  2017-09-27  5:56 [PR middle-end/82319] Fix ICE in pattern Yuri Gribov
@ 2017-09-27  6:01 ` Andrew Pinski
  2017-09-27  7:56   ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2017-09-27  6:01 UTC (permalink / raw)
  To: Yuri Gribov; +Cc: GCC Patches, Richard Biener, Martin Liška

On Tue, Sep 26, 2017 at 10:56 PM, Yuri Gribov <tetra2005@gmail.com> wrote:
> Hi all,
>
> This patch fixes a trivial ICE in recent pattern.  Bootstrapped and
> regtested on x86_64.
>
> Ok to commit?

>+ bool cst_int_p = ! real_isnan (cst) && real_identical (&icst, cst);

The GCC coding style says no space between the ! and the expression.
Note for clarity I would put () around !real_isnan (cst) though.
Other than that I don't see anything wrong with the patch (I cannot
approve the patch though).

Thanks,
Andrew

>
> -Y

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR middle-end/82319] Fix ICE in pattern
  2017-09-27  6:01 ` Andrew Pinski
@ 2017-09-27  7:56   ` Richard Biener
  2017-09-27  8:18     ` Andrew Pinski
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2017-09-27  7:56 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Yuri Gribov, GCC Patches, Martin Liška

On Tue, 26 Sep 2017, Andrew Pinski wrote:

> On Tue, Sep 26, 2017 at 10:56 PM, Yuri Gribov <tetra2005@gmail.com> wrote:
> > Hi all,
> >
> > This patch fixes a trivial ICE in recent pattern.  Bootstrapped and
> > regtested on x86_64.
> >
> > Ok to commit?

Ok.

> >+ bool cst_int_p = ! real_isnan (cst) && real_identical (&icst, cst);
> 
> The GCC coding style says no space between the ! and the expression.

Does it?  I thought it says the opposite.

Richard.

> Note for clarity I would put () around !real_isnan (cst) though.
> Other than that I don't see anything wrong with the patch (I cannot
> approve the patch though).
> 
> Thanks,
> Andrew
> 
> >
> > -Y
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR middle-end/82319] Fix ICE in pattern
  2017-09-27  7:56   ` Richard Biener
@ 2017-09-27  8:18     ` Andrew Pinski
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Pinski @ 2017-09-27  8:18 UTC (permalink / raw)
  To: Richard Biener; +Cc: Yuri Gribov, GCC Patches, Martin Liška

On Wed, Sep 27, 2017 at 12:56 AM, Richard Biener <rguenther@suse.de> wrote:
> On Tue, 26 Sep 2017, Andrew Pinski wrote:
>
>> On Tue, Sep 26, 2017 at 10:56 PM, Yuri Gribov <tetra2005@gmail.com> wrote:
>> > Hi all,
>> >
>> > This patch fixes a trivial ICE in recent pattern.  Bootstrapped and
>> > regtested on x86_64.
>> >
>> > Ok to commit?
>
> Ok.
>
>> >+ bool cst_int_p = ! real_isnan (cst) && real_identical (&icst, cst);
>>
>> The GCC coding style says no space between the ! and the expression.
>
> Does it?  I thought it says the opposite.

Yes, see https://gcc.gnu.org/codingconventions.html#Expressions .

For                               Use......instead of
logical not                     !x           ! x
bitwise complement      ~x         ~ x
unary minus                  -x          - x
cast                               (foo) x   (foo)x
pointer dereference      *x           * x


Thanks,
Andrew

>
> Richard.
>
>> Note for clarity I would put () around !real_isnan (cst) though.
>> Other than that I don't see anything wrong with the patch (I cannot
>> approve the patch though).
>>
>> Thanks,
>> Andrew
>>
>> >
>> > -Y
>>
>>
>
> --
> Richard Biener <rguenther@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-27  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-27  5:56 [PR middle-end/82319] Fix ICE in pattern Yuri Gribov
2017-09-27  6:01 ` Andrew Pinski
2017-09-27  7:56   ` Richard Biener
2017-09-27  8:18     ` Andrew Pinski

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).