From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6951 invoked by alias); 12 Dec 2008 13:15:16 -0000 Received: (qmail 6361 invoked by uid 48); 12 Dec 2008 13:13:56 -0000 Date: Fri, 12 Dec 2008 13:15:00 -0000 Subject: [Bug fortran/38504] New: double minus sign when printing integer? X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "kloedej at knmi dot nl" 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/msg01332.txt.bz2 There seems to be a small bug when writing an 8 byte integer to a character variable, as shown by this little test program: program IntAdtest integer, parameter :: i8_ = Selected_Int_Kind(18) ! = integer*8 character(len=22) :: str_value integer(i8_) :: value character(len=*), parameter :: format_IntAd = "(i22)" value = -9223372036854775807_i8_ write(str_value, format_IntAd) value print *,"str_value = ["//str_value//"]" value = -9223372036854775807_i8_ -1 write(str_value, format_IntAd) value print *,"str_value = ["//str_value//"]" end program IntAdtest When compiled with: gfortran -o IntAdtest IntAdtest.F90 I get the following output for the gfortran compiled executable: >IntAdtest str_value = [ -9223372036854775807] str_value = [ --9223372036854775808] For all several other compilers the result is as expected: >IntAdtest str_value = [ -9223372036854775807] str_value = [ -9223372036854775808] I used the following gfortran version for this test: gfortran --version GNU Fortran (GCC) 4.4.0 20081021 (experimental) [trunk revision 141258] Copyright (C) 2008 Free Software Foundation, Inc. best regards, Jos de Kloe -- Summary: double minus sign when printing integer? Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kloedej at knmi dot nl http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38504