[Bug fortran/46331] Compilation time long with simple function in array constructor

jvdelisle at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Nov 6 16:09:00 GMT 2010


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

--- Comment #1 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2010-11-06 16:09:30 UTC ---
I should add that if rand is the only function that acts like this, then this
is not of much value.  While just playing around, this translates as expected.
(Nice short -fdump-tree-original file.)

program foo
    implicit none

    Integer :: i
    Integer, Parameter :: N = 10**4
    Real, Dimension(N) :: xs

    ! Random points
    !xs = (/ (rand(0), i=1,N) /)
    xs = (/ (myfunction(0), i=1,N) /)
    !xs = myfunction (0.0)
    print *, xs
contains
  function myfunction(somenumber)
    integer :: somenumber
    real :: myfunction
    myfunction = 1234.567
    if (somenumber .eq. 42) return
    myfunction = somenumber + rand(0)
  end function
end program



More information about the Gcc-bugs mailing list