$ gfortran --version
GNU Fortran (Ubuntu 4.3.3-5ubuntu4) 4.3.3
...
$ cat crash.f90
program crash_random_number

    implicit none

    integer, parameter :: dp = kind(1.0d0)
    integer, parameter :: size = 100000000
    real(kind=dp), dimension(size) :: x, y

    ! call random_seed() ! doesn't seem to change anything
    ! if I have only this statement, it seems to succeed
    call random_number(x)
    ! with this one present, the process is killed _immediately_
    call random_number(y)

end program crash_random_number
$ gfortran -o crash_random_number -std=f95 -Wall -O0 crash.f90
$ ./crash_random_number
Killed
$

_Any_ of the following changes seems to let the program succeed on my machine:

* changing the real type to default real
* changing the array size from 100000000 (1e8) to 10000000 (1e7)
* commenting out the second call to random_number; however, if the second call
is present, as above, the program crashes immediately

The default integer size is 4 bytes with maximum 2147483647 (2.147483647e9), so
1e8 fits into the integer range.


-- 
           Summary: Generated program gets killed on subsequent calls to
                    random_number on "double precision" arrays of size
                    100000000 (1e8)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sschwarzer at sschwarzer dot net
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu


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

Reply via email to