compat-libgfortran-48/gcc48-pr80692.patch

54 lines
1.1 KiB
Diff
Raw Permalink Normal View History

2021-01-21 00:56:15 +00:00
2017-06-27 Segher Boessenkool <segher@kernel.crashing.org>
Backport from trunk
2017-05-17 Segher Boessenkool <segher@kernel.crashing.org>
PR middle-end/80692
* real.c (do_compare): Give decimal_do_compare preference over
comparing just the signs.
* gcc.c-torture/execute/pr80692.c: New testcase.
--- gcc/real.c
+++ gcc/real.c
@@ -950,12 +950,12 @@ do_compare (const REAL_VALUE_TYPE *a, const REAL_VALUE_TYPE *b,
gcc_unreachable ();
}
- if (a->sign != b->sign)
- return -a->sign - -b->sign;
-
if (a->decimal || b->decimal)
return decimal_do_compare (a, b, nan_result);
+ if (a->sign != b->sign)
+ return -a->sign - -b->sign;
+
if (REAL_EXP (a) > REAL_EXP (b))
ret = 1;
else if (REAL_EXP (a) < REAL_EXP (b))
--- /dev/null
+++ gcc/testsuite/gcc.c-torture/execute/pr80692.c
@@ -0,0 +1,11 @@
+int main () {
+ _Decimal64 d64 = -0.DD;
+
+ if (d64 != 0.DD)
+ __builtin_abort ();
+
+ if (d64 != -0.DD)
+ __builtin_abort ();
+
+ return 0;
+}
--- /dev/null
+++ gcc/testsuite/gcc.c-torture/execute/pr80692.x
@@ -0,0 +1,7 @@
+load_lib target-supports.exp
+
+if { ! [check_effective_target_dfp] } {
+ return 1
+}
+
+return 0