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
When compiled with gfortran 4.5.3 or older, the output is the one you expect: 1 k=8 / 4294967300 k=8 1 k=8 / 2147483650 k=8 From 4.6.4 to trunk the outputs is 1 k=8 / 4 k=8 1 k=8 / -2147483646 k=8
The change is due to revision 158253.
Author: burnus Date: Thu May 2 16:29:14 2013 New Revision: 198549 URL: http://gcc.gnu.org/viewcvs?rev=198549&root=gcc&view=rev Log: 2013-05-02 Tobias Burnus <burnus@net-b.de> PR fortran/57142 * simplify.c (gfc_simplify_size): Renamed from simplify_size; fix kind=8 handling. (gfc_simplify_size): New function. (gfc_simplify_shape): Add range check. * resolve.c (resolve_function): Fix handling for ISYM_SIZE. 2013-05-02 Tobias Burnus <burnus@net-b.de> PR fortran/57142 * gfortran.dg/size_kind_2.f90: New. * gfortran.dg/size_kind_3.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/size_kind_2.f90 trunk/gcc/testsuite/gfortran.dg/size_kind_3.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/fortran/simplify.c trunk/gcc/testsuite/ChangeLog
Author: burnus Date: Tue May 7 16:36:48 2013 New Revision: 198687 URL: http://gcc.gnu.org/viewcvs?rev=198687&root=gcc&view=rev Log: 2013-05-07 Tobias Burnus <burnus@net-b.de> Backport from mainline 2013-05-02 Tobias Burnus <burnus@net-b.de> PR fortran/57142 * simplify.c (gfc_simplify_size): Renamed from simplify_size; fix kind=8 handling. (gfc_simplify_size): New function. (gfc_simplify_shape): Add range check. 2013-05-07 Tobias Burnus <burnus@net-b.de> Backport from mainline 2013-05-02 Tobias Burnus <burnus@net-b.de> PR fortran/57142 * gfortran.dg/size_kind_2.f90: New. * gfortran.dg/size_kind_3.f90: New. Added: branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/size_kind_2.f90 branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/size_kind_3.f90 Modified: branches/gcc-4_8-branch/gcc/fortran/ChangeLog branches/gcc-4_8-branch/gcc/fortran/resolve.c branches/gcc-4_8-branch/gcc/fortran/simplify.c branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
Author: burnus Date: Tue May 7 17:28:12 2013 New Revision: 198690 URL: http://gcc.gnu.org/viewcvs?rev=198690&root=gcc&view=rev Log: 2013-05-07 Tobias Burnus <burnus@net-b.de> Backport from mainline 2013-05-02 Tobias Burnus <burnus@net-b.de> PR fortran/57142 * simplify.c (gfc_simplify_size): Renamed from simplify_size; fix kind=8 handling. (gfc_simplify_size): New function. (gfc_simplify_shape): Add range check. 2013-05-07 Tobias Burnus <burnus@net-b.de> Backport from mainline 2013-05-02 Tobias Burnus <burnus@net-b.de> PR fortran/57142 * gfortran.dg/size_kind_2.f90: New. * gfortran.dg/size_kind_3.f90: New. Added: branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/size_kind_2.f90 branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/size_kind_3.f90 Modified: branches/gcc-4_7-branch/gcc/fortran/ChangeLog branches/gcc-4_7-branch/gcc/fortran/resolve.c branches/gcc-4_7-branch/gcc/fortran/simplify.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
FIXED on the trunk (4.9) and on the 4.7/4.8 branch.