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

            Bug ID: 89274
           Summary: Inconsistent list directed output of INTEGER(16)
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dominiq at lps dot ens.fr
                CC: jvdelisle at gcc dot gnu.org
  Target Milestone: ---

The following test

integer(8)  :: i(2)
integer(16) :: j(2)
i = -huge(1)
print *, i
i = -huge(1_8)
print *, i
j = huge(1)
print *, j
j = huge(1_8)
print *, j
j = huge(1_16)
print *, j
j = -huge(1)
print *, j
j = -huge(1_8)
print *, j
j = -huge(1_16)
print *, j
end

gives at run time

          -2147483647          -2147483647
 -9223372036854775807 -9223372036854775807
 2147483647 2147483647
 9223372036854775807 9223372036854775807
 170141183460469231731687303715884105727
170141183460469231731687303715884105727
 -2147483647 -2147483647
 -9223372036854775807 -9223372036854775807
 -170141183460469231731687303715884105727
-170141183460469231731687303715884105727

since at least 4.8 up to trunk (9.0).

After applying the following patch

--- ../_clean/libgfortran/io/write.c    2019-01-01 13:40:19.000000000 +0100
+++ libgfortran/io/write.c      2019-02-10 11:03:35.000000000 +0100
@@ -1342,6 +1342,10 @@ write_integer (st_parameter_dt *dtp, con
       width = 20;
       break;

+    case 16:
+      width = 40;
+      break;
+
     default:
       width = 0;
       break;

one gets

          -2147483647          -2147483647
 -9223372036854775807 -9223372036854775807
                               2147483647                              
2147483647
                      9223372036854775807                     
9223372036854775807
  170141183460469231731687303715884105727 
170141183460469231731687303715884105727
                              -2147483647                             
-2147483647
                     -9223372036854775807                    
-9223372036854775807
 -170141183460469231731687303715884105727
-170141183460469231731687303715884105727

Reply via email to