diff options
author | Andreas Krebbel <krebbel@linux.ibm.com> | 2020-10-22 12:24:22 +0200 |
---|---|---|
committer | Andreas Krebbel <krebbel@linux.ibm.com> | 2020-10-22 12:38:01 +0200 |
commit | e3f25eac67aee77af0b2038cd4d6cbd36d7f1030 (patch) | |
tree | 6678a5d9c84a8a375b0f52f7e6d64f8288bfee42 /gcc | |
parent | f7decfaebbcb8522fcb39b03a391a5c2cb64f460 (diff) | |
download | gcc-e3f25eac67aee77af0b2038cd4d6cbd36d7f1030.zip gcc-e3f25eac67aee77af0b2038cd4d6cbd36d7f1030.tar.gz gcc-e3f25eac67aee77af0b2038cd4d6cbd36d7f1030.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/dfp.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/dfp/pr97439.c | 27 |
2 files changed, 29 insertions, 0 deletions
@@ -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 0000000..7fcf834 --- /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; +} |