# Internal compiler error with array-valued function

**URL:** <https://forums.developer.nvidia.com/t/internal-compiler-error-with-array-valued-function/134772>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [January 25, 2016, 3:00pm UTC](https://forums.developer.nvidia.com/t/internal-compiler-error-with-array-valued-function/134772 "2016-01-25T15:00:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lionel\_GUEZ](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Lionel\_GUEZ](https://forums.developer.nvidia.com/u/Lionel_GUEZ)\
**Post date:** [January 25, 2016, 3:00pm UTC](https://forums.developer.nvidia.com/t/internal-compiler-error-with-array-valued-function/134772/1 "2016-01-25T15:00:17Z")

</div>

Hello. Here is a test Fortran program:

```nohighlight
module regr12_conserv_m
  implicit none
contains
  subroutine regr12_conserv(xt, vt)
    real, intent(in):: xt(:)
    real, intent(in):: vt(:)
    integer n2
    n2 = 4
    print *, mean_lin(3.)
  contains
    function mean_lin(a)
      real, intent(in):: a
      real mean_lin(n2)
      mean_lin = 1.
    end function mean_lin
  end subroutine regr12_conserv
end module regr12_conserv_m

```

I am confident that this code is valid in Fortran 95. The internal function is array-valued. Its shape is explicit. Its size is given by a variable from the host program unit.

With the following version of pgfortran:

$ pgfortran -V

pgfortran 13.10-0 64-bit target on x86-64 Linux -tp istanbul  
The Portland Group - PGI Compilers and Tools  
Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.

here is the result of trying to compile this test code:

$ pgfortran -Mfree -c regr12\_conserv.f  
PGF90-F-0000-Internal compiler error. interf:new\_symbol\_and\_link, symbol not found 608 (regr12\_conserv.f: 8)  
PGF90/x86-64 Linux 13.10-0: compilation aborted

Please note that there is no problem with the other compilers I have access to: ifort, nagfor, gfortran.

I think this is a bug of the compiler. Is it corrected in more recent versions of the compiler?

---

<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:** [January 25, 2016, 6:27pm UTC](https://forums.developer.nvidia.com/t/internal-compiler-error-with-array-valued-function/134772/2 "2016-01-25T18:27:04Z")

</div>

Hi Lionel GUEZ,

Thanks for the report. We have not seen this error before and it does still occur in our current (15.10) compiler version. It looks like it’s a very specific problem only occurring when the function result variable is an automatic array and the size of the array is a local variable in the parent. If you declare “n2” as a module variable, pass “n2” as an argument to “mean\_lin”, or declare “mean\_lin” with a fixed size, then the compilation error goes away.

I added a problem report (TPR#22237) and sent it on to our compiler engineers for further investigation.

Best regards,  
Mat

---

<div class="post-metadata">

**Author:** ![tull](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tull](https://forums.developer.nvidia.com/u/tull)\
**Post date:** [April 19, 2016, 12:26am UTC](https://forums.developer.nvidia.com/t/internal-compiler-error-with-array-valued-function/134772/3 "2016-04-19T00:26:14Z")

</div>

Lionel,

In January, you sent a problem logged as

TPR 22237 - UF: ICE “interf:new\_symbol\_and\_link, symbol not found 608” when using a contained function

This problem is fixed in the current 16.4 release.  
  
  
thanks,  
dave
