This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/36153] New: ICE on size with kind parameter
- From: "J dot Hogg at rl dot ac dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 May 2008 11:06:13 -0000
- Subject: [Bug fortran/36153] New: ICE on size with kind parameter
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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 <http://gcc.gnu.org/bugs.html> 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