From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21415 invoked by alias); 6 May 2008 11:06:59 -0000 Received: (qmail 21288 invoked by uid 48); 6 May 2008 11:06:13 -0000 Date: Tue, 06 May 2008 11:06:00 -0000 Subject: [Bug fortran/36153] New: ICE on size with kind parameter X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "J dot Hogg at rl dot ac dot uk" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-05/txt/msg00423.txt.bz2 Use of an optional kind parameter on a call to the intrinsic size was added in Fortran 2003, and is essential to avoid overflow when dealing with arrays bigger than huge(0). The following example provides test code and demonstrates this. gfortran should warn that this is non-standard fortran 90/95 and fail gracefully, and/or work as per the F2003 spec. Thanks, Jonathan. [user@host] ~/bugs/gfortran-4.3/size_kind $ gfortran-4.3 -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../configure --program-suffix=-4.3 Thread model: posix gcc version 4.3.0 (GCC) [user@host] ~/bugs/gfortran-4.3/size_kind $ gfortran-4.3 test_64.f90 f951: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See for instructions. [user@host] ~/bugs/gfortran-4.3/size_kind $ cat test_64.f90 program test_64 implicit none integer, parameter :: long = selected_int_kind(18) integer, parameter :: short = kind(0) integer(long), parameter :: big_sz = huge(0_short)+1000_long integer(long), parameter :: max_32 = huge(0_short) integer, dimension(:), allocatable :: array integer(long) :: i print *, "2**31 = ", 2_long**31 print *, "max_32 = ", max_32 print *, "big_sz = ", big_sz allocate(array(big_sz)) print *, "sz = ", size(array) print *, "sz = ", size(array, kind=long) end program -- Summary: ICE on size with kind parameter Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: J dot Hogg at rl dot ac dot uk GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36153