Hello,

I have a problem with functions wich have the
same allocated vector in input and output.
Program test (see below) returns a segmentation fault when
it is compiled by gfortran, but works with intel 
compiler. The problem is that gfortran does not use
a temporary vector and try to write directly on
the input vector.

Thank you for your help.

--------
program test

  implicit none

  double precision, dimension(:), allocatable::a
  integer::n

  print*,'entrez n'
  read*,n

  allocate(a(n))

  a(:)=1d0

  a=equal(a)

  print*,"a=",a

  deallocate(a)

  contains

    function equal(v) result(u)
      double precision, intent(in),dimension(:)::v
      double precision, dimension(size(v))::u

      u=v

    end function equal

end program test


-- 
           Summary: functions and allocated vectors
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: delphine dot jennequin at cea dot fr


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

Reply via email to