public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38504]  New: double minus sign when printing integer?
@ 2008-12-12 13:15 kloedej at knmi dot nl
  2008-12-12 13:58 ` [Bug fortran/38504] " dfranke at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: kloedej at knmi dot nl @ 2008-12-12 13:15 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2008-12-14  7:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-12 13:15 [Bug fortran/38504] New: double minus sign when printing integer? kloedej at knmi dot nl
2008-12-12 13:58 ` [Bug fortran/38504] " dfranke at gcc dot gnu dot org
2008-12-12 14:48 ` kloedej at knmi dot nl
2008-12-12 15:17 ` kargl at gcc dot gnu dot org
2008-12-12 16:00 ` dfranke at gcc dot gnu dot org
2008-12-12 16:04 ` kargl at gcc dot gnu dot org
2008-12-13 11:20 ` burnus at gcc dot gnu dot org
2008-12-13 15:33 ` jvdelisle at gcc dot gnu dot org
2008-12-13 15:43 ` jvdelisle at gcc dot gnu dot org
2008-12-13 16:29 ` jvdelisle at gcc dot gnu dot org
2008-12-13 19:36 ` jvdelisle at gcc dot gnu dot org
2008-12-14  6:53 ` jvdelisle at gcc dot gnu dot org
2008-12-14  7:01 ` jvdelisle at gcc dot gnu dot org
2008-12-14  7:03 ` jvdelisle at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).