[Bug fortran/57142] New: SIZE/SHAPE overflow despite kind=8

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 2 11:44:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57142

             Bug #: 57142
           Summary: SIZE/SHAPE overflow despite kind=8
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: diagnostic, wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


The following program should print:
  1 k=8 / 4294967300 k=8
  1 k=8 / 2147483650 k=8

However, it prints:
  1 k=8 / 4 k=8
  1 k=8 / -2147483646 k=8

Expected:
* kind=8 is properly handled
* With kind=4, a warning/error is printed that the value exceeds huge(1_4)

NOTE: shape has the same issue; ubound/lbound are okay (in both regards). The
run-time version is fine.


!integer :: A(huge(1)+2_8), B(2,3)
integer :: A(1), B(huge(1)+3_8,2_8)
print '(4(i0,a))', size(A,kind=8),' k=', kind(size(A,kind=8)),' / ', &
                   size(B,kind=8),' k=', kind(size(B,kind=8))
print '(4(i0,a))', size(A,dim=1,kind=8),' k=', kind(size(A,dim=1,kind=8)), &
      ' / ',       size(B,dim=1,kind=8),' k=', kind(size(B,dim=1,kind=8))
end



More information about the Gcc-bugs mailing list