Hi,
We are having an issue with an internal compiler error when using PGI Fortran 14.10 (and earlier versions). The code we are working with successfully compiles and runs with two other compilers (gfortran 4.8.3 and ifort 14.0.3), however pgfortran reports “Lowering Errors”. The code excerpt below illustrates the problem:
!! The sms_matrix module holds the basic data types for storing square
!! matrices in a variety of sparse matrix formats.
!<
module sms_matrix
implicit none
!> The super type for all square NxN ( n_unknowns x n_unknowns )
!> compressed storage arrays
type, abstract :: matrix
!> Number of unknowns in the matrix system, so a NxN matrix has n_unknowns = N
integer :: n_unknowns
contains
!> matvec maps to an A*x procedure
procedure(matveci), deferred :: matvec
end type matrix
abstract interface
pure function matveci(A, x) result(y)
import :: matrix
class(matrix), intent(in) :: A
integer, dimension(A%n_unknowns), intent(in) :: x
integer, dimension(A%n_unknowns) :: y
end function matveci
end interface
end module sms_matrix
If this module is compiled, the following errors are produced:
Lowering Error: array upper bound is not a symbol for datatype 65
Lowering Error: array extnt is not a symbol for datatype 65
PGF90-F-0000-Internal compiler error. Errors in Lowering 2 (sms_matrix.f90: 36)
However, if the dimension(A%n_unknowns) for variable ‘y’ is changed to a
deferred shape specification, pgfortran will compile it. This change causes both gfortran and ifort to complain with:
>gfortran sms_matrix.f90
sms_matrix.f90:24.41:
pure function matveci(A, x) result(y)
1
Error: Array 'y' at (1) cannot have a deferred shape
>ifort sms_matrix.f90
sms_matrix.f90(24): error #6688: The array-spec for a function name with no POINTER attribute must be an explicit shape array (R505.9). [MATVECI]
pure function matveci(A, x) result(y)
------------------^
sms_matrix.f90(24): error #6596: If a deferred-shape array is intended, then the ALLOCATABLE or POINTER attribute is missing; if an assumed-shape array is intended, the array must be a dummy argument. [Y]
pure function matveci(A, x) result(y)
---------------------------------------^
compilation aborted for sms_matrix.f90 (code 1)
It seems like the original code is correct, but we could be missing something subtle about how OO Fortran 03/08 works.
Thanks,
Brent