Hello all.
I am currently porting some code from windows where I have been using CVF6.6B,
to a unix platform using Sun Workshop 6 update 2.
I have the following module, which compiles and executes fine with CVF. However,
the SUN compiler gives the following compiler error:
****************************************************
MODULE demonstrate_problem
^
"demonstrate_problem.f90", Line = 1, Column = 8: ERROR: The compiler has
detected errors in module "DEMONSTRATE_PROBLEM". No module information file
will be created for this module.
BB%lci=AA%lci
^
"sparse_error_mod.f90", Line = 42, Column = 14: ERROR: "AA" must not be defined
inside of a pure subprogram. It is in common, a dummy argument or host or use
associated.
BB%noc=AA%noc
^
"sparse_error_mod.f90", Line = 43, Column = 14: ERROR: "AA" must not be defined
inside of a pure subprogram. It is in common, a dummy argument or host or use
associated.
BB%mat(1_I4:AA%noc(i),i)=AA%mat(1_I4:AA%noc(i),i)*scal
^
"sparse_error_mod.f90", Line = 47, Column = 22: ERROR: "AA" must not be defined
inside of a pure subprogram. It is in common, a dummy argument or host or use
associated.
^
"sparse_error_mod.f90", Line = 47, Column = 35: ERROR: "AA" must not be defined
inside of a pure subprogram. It is in common, a dummy argument or host or use
associated.
^
"sparse_error_mod.f90", Line = 47, Column = 47: ERROR: "AA" must not be defined
inside of a pure subprogram. It is in common, a dummy argument or host or use
associated.
f90: COMPILE TIME 0.040000 SECONDS
f90: MAXIMUM FIELD LENGTH 4962862 DECIMAL WORDS
f90: 54 SOURCE LINES
f90: 6 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
****************************************************
The problem is, that I don't agree with the error. It says that I am trying to
define AA within the procedure, but as far as I can tell I am not. I'd be
grateful if someone could spare the time to look over the module and let me know
whether they think my code is or isn't standard conforming, and hence whether
the CVF compiler isn't picking up an error that it should or the SUN compiler is
producing an incorrect error.
Cheers,
Paul
*************************************************
MODULE demonstrate_problem
IMPLICIT NONE
PRIVATE
INTEGER, PARAMETER :: I4=SELECTED_INT_KIND(9)
INTEGER, PARAMETER :: RD=SELECTED_REAL_KIND(15, 307)
TYPE :: sparse_type
REAL(RD), DIMENSION(:,:), POINTER :: mat => NULL()
INTEGER(I4), DIMENSION(:), POINTER :: lci => NULL()
INTEGER(I4), DIMENSION(:), POINTER :: noc => NULL()
INTEGER(I4) :: M
END TYPE
CONTAINS
PURE TYPE(sparse_type) FUNCTION sparse_times_scal_fun(AA,scal) RESULT(BB)
IMPLICIT NONE
! INPUTS
TYPE(sparse_type), INTENT(IN) :: AA
REAL(RD), INTENT(IN) :: scal
! OUTPUTS
! BB
! LOCAL
INTEGER(I4) :: i
ALLOCATE(BB%mat(SIZE(AA%mat,1_I4),SIZE(AA%mat,2_I4)))
ALLOCATE(BB%lci(SIZE(AA%lci)))
ALLOCATE(BB%noc(SIZE(AA%noc)))
BB%lci=AA%lci
BB%noc=AA%noc
FORALL (i=1_I4:SIZE(AA%lci))
BB%mat(1_I4:AA%noc(i),i)=AA%mat(1_I4:AA%noc(i),i)*scal
END FORALL
END FUNCTION sparse_times_scal_fun
END MODULE demonstrate_problem
|