summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-14 06:50:53 +0000
committerjvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4>2008-12-14 06:50:53 +0000
commitd46b08a9748f9515d19cceea8a8ee853861fcfbf (patch)
tree9e98240a5e8f47645adfeedfcc4b145945980653 /libgfortran
parent909c9464adde52f30541b90ea047dc2fd8dfe58a (diff)
downloadgcc-d46b08a9748f9515d19cceea8a8ee853861fcfbf.tar.gz
2008-12-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/38504 io/write.c (write_decimal): Skip extra sign '-' at beginning of string returned by gfc_itoa. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142747 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/write.c9
2 files changed, 14 insertions, 1 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index dcc4867882e..3be2b224698 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libfortran/38504
+ io/write.c (write_decimal): Skip extra sign '-' at beginning of string
+ returned by gfc_itoa.
+
2008-12-08 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/38430
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index 32c58471bb8..3cd67b39ba7 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -600,9 +600,16 @@ write_decimal (st_parameter_dt *dtp, const fnode *f, const char *source,
sign = calculate_sign (dtp, n < 0);
if (n < 0)
n = -n;
-
nsign = sign == S_NONE ? 0 : 1;
+
+ /* conv calls gfc_itoa which sets the negative sign needed
+ by write_integer. The sign '+' or '-' is set below based on sign
+ calculated above, so we just point past the sign in the string
+ before proceeding to avoid double signs in corner cases.
+ (see PR38504) */
q = conv (n, itoa_buf, sizeof (itoa_buf));
+ if (*q == '-')
+ q++;
digits = strlen (q);