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