aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2008-12-14 06:50:53 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2008-12-14 06:50:53 +0000
commit07e9d8beb7f6414eae2e5862acc2fb4ddc47a032 (patch)
tree9e98240a5e8f47645adfeedfcc4b145945980653 /libgfortran
parent7b5be687fcdf079e9cb458484144687841f8a9a5 (diff)
downloadgcc-07e9d8beb7f6414eae2e5862acc2fb4ddc47a032.zip
gcc-07e9d8beb7f6414eae2e5862acc2fb4ddc47a032.tar.gz
gcc-07e9d8beb7f6414eae2e5862acc2fb4ddc47a032.tar.bz2
re PR fortran/38504 (double minus sign when printing integer?)
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. From-SVN: r142747
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 dcc4867..3be2b22 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 32c5847..3cd67b3 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);