From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27737 invoked by alias); 13 Dec 2008 19:36:12 -0000 Received: (qmail 27468 invoked by uid 48); 13 Dec 2008 19:34:51 -0000 Date: Sat, 13 Dec 2008 19:36:00 -0000 Message-ID: <20081213193451.27467.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/38504] double minus sign when printing integer? In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jvdelisle at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-12/txt/msg01435.txt.bz2 ------- Comment #10 from jvdelisle at gcc dot gnu dot org 2008-12-13 19:34 ------- Testing this. Index: write.c =================================================================== --- write.c (revision 142574) +++ write.c (working copy) @@ -600,9 +600,16 @@ write_decimal (st_parameter_dt *dtp, con 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); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38504