Hi Andre,

just a couple of remarks.

You are adding significant new code to an existing
test case, allocate_with_source_3.f90.  As discussed
previously, it would be better to put the new code
into an extra test case.

The following test case segfaults with your patch
with an "invalid free":

module foo
contains
  integer function f()
    f = 2
  end function f
end module foo
program main
  use foo
  integer :: n
  n = 42
  block
    real, dimension(0:n) :: a
    real, dimension(:), allocatable :: c
    call random_number(a)
    allocate(c,source=a(:f()))
  end block
end program main

You could also add

    n = n - 1
    allocate(c,source=a)
    if (size(a,1) /= size(c,1)) call abort

to the test case above to make sure that changing a variable
that was used to declare an array bound does not lead to wrong
code.

Regards

        Thomas

Reply via email to