# \-mc=model or -Mlarge\_arrays with array extent

**URL:** <https://forums.developer.nvidia.com/t/mc-model-or-mlarge-arrays-with-array-extent/131444>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [November 7, 2009, 8:26pm UTC](https://forums.developer.nvidia.com/t/mc-model-or-mlarge-arrays-with-array-extent/131444 "2009-11-07T20:26:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tuan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Tuan](https://forums.developer.nvidia.com/u/Tuan)\
**Post date:** [November 7, 2009, 8:26pm UTC](https://forums.developer.nvidia.com/t/mc-model-or-mlarge-arrays-with-array-extent/131444/1 "2009-11-07T20:26:56Z")

</div>

Hi,  
I got this weird behavior of PGI Fortran 9.0-4.  
program main  
REAL, DIMENSION(:, :), ALLOCATABLE : A

## allocate(A(10,10)) call func(A) end program main

## subroutine func(A) REAL, DIMENSION(:, :) :: A INTEGER :: x x = size(A,1) print \*, x end subroutine

If I compile the program without -mc=model or -Mlarge\_arrays, the extent of the matrix A is retrieved correctly, as I print x out. However, when I use either of these two options, I only get zeros for any extents of the array A. Could any suggest me how to resolve this as I want to know the array extent without passing it via dummy arguments. I tested with intrinsic matmul, there is no problem with this function.

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [November 9, 2009, 8:31pm UTC](https://forums.developer.nvidia.com/t/mc-model-or-mlarge-arrays-with-array-extent/131444/2 "2009-11-09T20:31:39Z")

</div>

Hi Tuan,

Can you please post an example of the behavior your seeing? The code you posted works fine for me (after adding an interface block).

```nohighlight
% cat test.f90
program main

REAL, DIMENSION(:, :), ALLOCATABLE :: A

interface
   subroutine func(A)
     REAL, DIMENSION(:, :) :: A
   end subroutine func
end interface

allocate(A(10,10))
call func(A)

end program main

subroutine func(A)
REAL, DIMENSION(:, :) :: A
INTEGER :: x
x = size(A,1)
print *, x
end subroutine

% pgf90 test.f90 -fast -V9.0-4 -o test904.out
% test904.out
           10
% pgf90 test.f90 -fast -V9.0-4 -Mlarge_arrays -o test904_large.out
% test904_large.out
           10

```

Thanks,  
Mat

---

<div class="post-metadata">

**Author:** ![Tuan](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Tuan](https://forums.developer.nvidia.com/u/Tuan)\
**Post date:** [November 21, 2009, 1:23am UTC](https://forums.developer.nvidia.com/t/mc-model-or-mlarge-arrays-with-array-extent/131444/3 "2009-11-21T01:23:54Z")

</div>

Thanks mkcolg, I’ve just realized the issue also.

This happens as Fortran does not automatically generate the dimension information for the array if it is in the same file of the caller.
