aboutsummaryrefslogtreecommitdiff
path: root/gcc/real.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/real.cc')
-rw-r--r--gcc/real.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/real.cc b/gcc/real.cc
index 1f987d4..43d2524 100644
--- a/gcc/real.cc
+++ b/gcc/real.cc
@@ -1629,6 +1629,11 @@ real_to_decimal_for_mode (char *str, const REAL_VALUE_TYPE *r_orig,
strcpy (str, (r.sign ? "-0.0" : "0.0"));
return;
case rvc_normal:
+ /* When r_orig is a positive value that converts to all nines and is
+ rounded up to 1.0, str[0] is harmlessly accessed before being set to
+ '1'. That read access triggers a valgrind warning. Setting str[0]
+ to any value quiets the warning. */
+ str[0] = ' ';
break;
case rvc_inf:
strcpy (str, (r.sign ? "-Inf" : "+Inf"));