re PR target/79487 (Invalid _Decimal32 comparison on s390x)
authorJakub Jelinek <jakub@redhat.com>
Wed, 15 Feb 2017 12:19:53 +0000 (13:19 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 15 Feb 2017 12:19:53 +0000 (13:19 +0100)
PR target/79487
* real.c (real_from_integer): Call real_convert even for decimal.

* gcc.dg/dfp/pr79487.c: New test.
* c-c++-common/ubsan/float-cast-overflow-8.c (TEST): Revert
2017-02-13 change.

From-SVN: r245477

gcc/ChangeLog
gcc/real.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-8.c
gcc/testsuite/gcc.dg/dfp/pr79487.c [new file with mode: 0644]

index 1b87c8a559b1c9173808d01f22ceda933d4c5a4f..7466dab12747ffc33ac129c9913ac66443508782 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/79487
+       * real.c (real_from_integer): Call real_convert even for decimal.
+
 2017-02-15  Dominik Vogt  <vogt@linux.vnet.ibm.com>
 
        PR target/79421
index 5f2b573078a7054e061eeac5f2c28cd929e6f1f2..97452a9701ed0be019dee1950ade5e4d63a2ff12 100644 (file)
@@ -2266,7 +2266,7 @@ real_from_integer (REAL_VALUE_TYPE *r, format_helper fmt,
 
   if (fmt.decimal_p ())
     decimal_from_integer (r);
-  else if (fmt)
+  if (fmt)
     real_convert (r, fmt, r);
 }
 
index db52ab932826705513c8b70f9dd0a5154268f822..a379d2ab6b8b5b9aef814f695a87eff0b98937aa 100644 (file)
@@ -1,3 +1,10 @@
+2017-02-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/79487
+       * gcc.dg/dfp/pr79487.c: New test.
+       * c-c++-common/ubsan/float-cast-overflow-8.c (TEST): Revert
+       2017-02-13 change.
+
 2017-01-14  Carl Love  <cel@us.ibm.com>
 
        * gcc.target/powerpc/vsx-builtin-3.c: Add missing test case for the
index 1b51609cf0767892fb625ff9088b8a70a5c64ef5..4adb22ae3b4711fe75329cf77131e237a0cf711b 100644 (file)
@@ -8,7 +8,7 @@
 #define TEST(type1, type2) \
   if (type1##_MIN)                                             \
     {                                                          \
-      volatile type2 min = type1##_MIN;                                \
+      type2 min = type1##_MIN;                                 \
       type2 add = -1.0;                                                \
       while (1)                                                        \
        {                                                       \
@@ -28,7 +28,7 @@
       volatile type1 tem3 = cvt_##type1##_##type2 (-1.0f);     \
     }                                                          \
   {                                                            \
-    volatile type2 max = type1##_MAX;                          \
+    type2 max = type1##_MAX;                                   \
     type2 add = 1.0;                                           \
     while (1)                                                  \
       {                                                                \
diff --git a/gcc/testsuite/gcc.dg/dfp/pr79487.c b/gcc/testsuite/gcc.dg/dfp/pr79487.c
new file mode 100644 (file)
index 0000000..f76ddee
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR target/79487 */
+/* { dg-options "-O2" } */
+
+int
+main ()
+{
+  _Decimal32 a = (-9223372036854775807LL - 1LL); 
+  _Decimal32 b = -9.223372E+18DF;
+  if (b - a != 0.0DF)
+    __builtin_abort ();
+  _Decimal64 c = (-9223372036854775807LL - 1LL); 
+  _Decimal64 d = -9.223372036854776E+18DD;
+  if (d - c != 0.0DD)
+    __builtin_abort ();
+  return 0;
+}