From: Jakub Jelinek Date: Wed, 15 Feb 2017 12:19:53 +0000 (+0100) Subject: re PR target/79487 (Invalid _Decimal32 comparison on s390x) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fa8db6eaf2d95fc77b96c5eeb36813175dd9ab97;p=gcc.git re PR target/79487 (Invalid _Decimal32 comparison on s390x) 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1b87c8a559b..7466dab1274 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-02-15 Jakub Jelinek + + PR target/79487 + * real.c (real_from_integer): Call real_convert even for decimal. + 2017-02-15 Dominik Vogt PR target/79421 diff --git a/gcc/real.c b/gcc/real.c index 5f2b573078a..97452a9701e 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index db52ab93282..a379d2ab6b8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2017-02-15 Jakub Jelinek + + 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 * gcc.target/powerpc/vsx-builtin-3.c: Add missing test case for the diff --git a/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-8.c b/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-8.c index 1b51609cf07..4adb22ae3b4 100644 --- a/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-8.c +++ b/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-8.c @@ -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 index 00000000000..f76ddeeac37 --- /dev/null +++ b/gcc/testsuite/gcc.dg/dfp/pr79487.c @@ -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; +}