aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/dfp/pr31385.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/dfp/pr31385.c')
-rw-r--r--gcc/testsuite/gcc.dg/dfp/pr31385.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/dfp/pr31385.c b/gcc/testsuite/gcc.dg/dfp/pr31385.c
new file mode 100644
index 00000000000..63a23c4bb75
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/dfp/pr31385.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -O2" } */
+
+typedef _Decimal32 fp_t;
+
+extern fp_t g(fp_t);
+
+fp_t
+bug(fp_t x)
+{
+ fp_t result;
+ int n;
+ fp_t f, f3, y, z;
+
+ n = 0;
+ y = 1.DF;
+ f = g(x);
+
+ if (f < 0.DF)
+ f = -f;
+
+ f3 = 2.DF;
+
+ z = (y + y + f / (y * y));
+ y = (z + z) / (9.DF) + f3 / (z * z);
+
+ result = y;
+
+ return (result);
+}