https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66311

            Bug ID: 66311
           Summary: [5 Regression] Problems with some integer(16) values
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fort...@t-online.de
  Target Milestone: ---

First of all, it's great to support integer(16).

But printing some numbers from range 2^63 to 2^64-1 with this snippet :

   program p
      print *, 9000000000000000000_16
      print *, huge(1_8)
      print *, 2_16**63
      print *, 10000000000000000000_16
      print *, 18446744065119617024_16
      print *, 2_16**64 - 1
      print *, 2_16**64
      print *, 20000000000000000000_16
   end


yields a wrong output for gfortran 5.1.1 (on SUSE Linux 13.2, 64 bit)

 9000000000000000000
  9223372036854775807
 -9223372036854775808
 -8446744073709551616
 -8589934592
 -1
 18446744073709551616
 20000000000000000000


Whereas with gfortran 4.9.0 and 4.8.3 the printed numbers are correct:

 9000000000000000000
  9223372036854775807
 9223372036854775808
 10000000000000000000
 18446744065119617024
 18446744073709551615
 18446744073709551616
 20000000000000000000


---

Same issue for the corresponding negative range :

   program p
      print *, -9000000000000000000_16
      print *, -huge(1_8)
      print *, -(2_16**63)
      print *, -10000000000000000000_16
      print *, -18446744065119617024_16
      print *, -(2_16**64 - 1)
      print *, -(2_16**64)
      print *, -20000000000000000000_16
   end


Result with gfortran 5.1.1 :

 -9000000000000000000
 -9223372036854775807
 9223372036854775808
 8446744073709551616
 8589934592
 1
 -18446744073709551616
 -20000000000000000000


Result with gfortran 4.9.0 and 4.8.3 :

 -9000000000000000000
 -9223372036854775807
 -9223372036854775808
 -10000000000000000000
 -18446744065119617024
 -18446744073709551615
 -18446744073709551616
 -20000000000000000000

Reply via email to