public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36153]  New: ICE on size with kind parameter
@ 2008-05-06 11:06 J dot Hogg at rl dot ac dot uk
  2008-05-06 14:43 ` [Bug fortran/36153] " burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: J dot Hogg at rl dot ac dot uk @ 2008-05-06 11:06 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-09-06 15:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-06 11:06 [Bug fortran/36153] New: ICE on size with kind parameter J dot Hogg at rl dot ac dot uk
2008-05-06 14:43 ` [Bug fortran/36153] " burnus at gcc dot gnu dot org
2008-05-06 15:18 ` kargl at gcc dot gnu dot org
2008-08-29 23:21 ` [Bug fortran/36153] ICE on size with kind parameter [F2003] kargl at gcc dot gnu dot org
2008-09-06 15:30 ` burnus at gcc dot gnu dot org
2008-09-06 15:57 ` burnus at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).