]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/dfp.c
[Ada] Small improvement to Expand_N_Unchecked_Type_Conversion
[thirdparty/gcc.git] / gcc / dfp.c
index 230b1b14eaab2c578a53890656aaa1340baafa24..fef39a5ce399d642cf5bc6879a05d51d187b6301 100644 (file)
--- a/gcc/dfp.c
+++ b/gcc/dfp.c
@@ -1,5 +1,5 @@
 /* Decimal floating point support.
-   Copyright (C) 2005-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -342,9 +342,13 @@ decimal_to_binary (REAL_VALUE_TYPE *to, const REAL_VALUE_TYPE *from,
                   const real_format *fmt)
 {
   char string[256];
-  const decimal128 *const d128 = (const decimal128 *) from->sig;
-
-  decimal128ToString (d128, string);
+  if (from->cl == rvc_normal)
+    {
+      const decimal128 *const d128 = (const decimal128 *) from->sig;
+      decimal128ToString (d128, string);
+    }
+  else
+    real_to_decimal (string, from, sizeof (string), 0, 1);
   real_from_string3 (to, string, fmt);
 }