I have least squares code which I am trying to rewrite in FORTRAN90. I have a pair of allocatable arrays declared in MAIN. I pass those unallocated arrays to a subroutine where the arrays are allocated and data is assigned. However, I get segmentation faults every time I try to run this section of code. The salient pieces of code are: (from MAIN) IMPLICIT NONE REAL, ALLOCATABLE, DIMENSION(:) :: X,Y ... CALL GETDATA(X,Y,N) ... SUBROUTINE GETDATA(X,Y,N) REAL, ALLOCATABLE, DIMENSION(:) :: X,Y ...(read in values from file - this works) ALLOCATE(X(N), Y(N)) !N has been determined earlier - and the value is correct. When I hit the allocate statement, the program dies. This code should work and I am unsure why it is not. If I do this in main I have no problem. But I do not understand why passing values via a subroutine causes problems. Any ideas why this code may not work would be appreciated. THanks!