我有一些演示Fortran代码(应该会成功编译)并尝试在Intel Visual Fortran + VS2013中编译。但是我在编译期间遇到了错误
error #6633: The type of the actual argument differs from the type of the dummy argument
第6行中的代码似乎有一些问题,但我无法弄清楚
除此之外:我可以在命令行中成功编译此代码,因此Visual Studio设置很有可能。但我无法弄清楚哪个选项是负责任的。某些解决方案建议禁用Check Routine Interface
选项,但这似乎太危险了。
SUBROUTINE FUNARR (A,N)
IMPLICIT NONE
INTEGER:: N
REAL,DIMENSION(N):: A
WRITE(*,*)"FUNARR VECTOR SUBSCRIPT....IN"
WRITE(*,'(10F12.6)')A(:N)
WRITE(*,*)"FUNARR VECTOR SUBSCRIPT....OUT"
A(:N)=A(:N)-100
END SUBROUTINE
PROGRAM WWW_FCODE_CN
IMPLICIT NONE
INTEGER,PARAMETER:: NMAX=100
REAL,PARAMETER:: PI=3.14159265
REAL,DIMENSION(NMAX):: ARR
INTEGER,DIMENSION(5):: VECSUBSCP=(/1,4,6,7,5/)
INTEGER:: NARR,I
NARR=10
ARR=1.
ARR(:NARR)=1.
WRITE(*,*)"ASSIGN TOTAL"
WRITE(*,'(10F12.6)')ARR(:NARR)
WRITE(*,*)
ARR(1)=-1.
WRITE(*,*)"ASSIGN ELEMENT"
WRITE(*,'(10F12.6)')ARR(:NARR)
WRITE(*,*)
ARR(2:4)=(/(SIN(PI*(I-1.)/(NARR-1)),I=2,4)/)
WRITE(*,*)"ASSIGN SLICE"
WRITE(*,'(10F12.6)')ARR(:NARR)
WRITE(*,*)
CALL FUNARR(ARR(2:4),3)
WRITE(*,*)"FUNARR SLICE"
WRITE(*,'(10F12.6)')ARR(:NARR)
WRITE(*,*)
ARR(VECSUBSCP(:3))=0.5
WRITE(*,*)"ASSIGN VECTOR SUBSCRIPT"
WRITE(*,'(10F12.6)')ARR(:NARR)
WRITE(*,*)
! ACTUAL ARGUMENT IS AN ARRAY SECTION WITH A VECTOR SUBSCRIPT
! DISCONTINUE,COPY,UNKNOWN POSITION,CANNOT BE INTENT(OUT)
CALL FUNARR(ARR(VECSUBSCP(3:5)),3)
WRITE(*,*)"FUNARR VECTOR SUBSCRIPT"
WRITE(*,'(10F12.6)')ARR(:NARR)
WRITE(*,*)
STOP
END PROGRAM WWW_FCODE_CN