public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/redhat/heads/gcc-8-branch)] Fix PR97439
@ 2021-04-23 10:17 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2021-04-23 10:17 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:a7d3501be5cd575dc338e0d4f091d62d62dd619a

commit a7d3501be5cd575dc338e0d4f091d62d62dd619a
Author: Andreas Krebbel <krebbel@linux.ibm.com>
Date:   Thu Oct 22 12:24:22 2020 +0200

    Fix PR97439
    
    decimal_real_maxval misses to set the sign flag in the REAL_VALUE_TYPE.
    
    gcc/ChangeLog:
    
            PR rtl-optimization/97439
            * dfp.c (decimal_real_maxval): Set the sign flag in the
            generated number.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.dg/dfp/pr97439.c: New test.
    
    (cherry picked from commit e3f25eac67aee77af0b2038cd4d6cbd36d7f1030)

Diff:
---
 gcc/dfp.c                          |  2 ++
 gcc/testsuite/gcc.dg/dfp/pr97439.c | 27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/gcc/dfp.c b/gcc/dfp.c
index 26efdc51901..ee47c30b1f5 100644
--- a/gcc/dfp.c
+++ b/gcc/dfp.c
@@ -740,4 +740,6 @@ decimal_real_maxval (REAL_VALUE_TYPE *r, int sign, machine_mode mode)
   decimal_real_from_string (r, max);
   if (sign)
     decimal128SetSign ((decimal128 *) r->sig, 1);
+
+  r->sign = sign;
 }
diff --git a/gcc/testsuite/gcc.dg/dfp/pr97439.c b/gcc/testsuite/gcc.dg/dfp/pr97439.c
new file mode 100644
index 00000000000..7fcf834043c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pr97439.c
@@ -0,0 +1,27 @@
+// { dg-do run }
+// { dg-options "-O1" }
+
+static int
+foo(_Decimal128 x, _Decimal128 y)
+{
+  if (x > y)
+    return 1;
+
+  return 0;
+}
+
+int __attribute__((noinline))
+bar(_Decimal128 x)
+{
+  return foo (x, -1.0DL * __builtin_infd32());
+}
+
+int
+main (void)
+{
+  int res = bar (0.0DL);
+  if (res != 1)
+    __builtin_abort ();
+
+  return 0;
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-23 10:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 10:17 [gcc(refs/vendors/redhat/heads/gcc-8-branch)] Fix PR97439 Jakub Jelinek

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