Botton 发表于 2020-4-7 16:27:36

A specification statement cannot appear in the executable section

代码如下:module zx
    integer, parameter :: N=4
    real::k_y
    real,dimension(N,N) :: a
    real,dimension(N,N) :: b
    real,dimension(N,N) :: c
    real,dimension(N,N) :: d
    real,dimension(2*N,2*N) :: e
    real,dimension(2*N,2*N) :: f
    real,dimension(2*N,2*N) :: g
    real,dimension(N,N) :: inv_e
    end module zx


    subroutine xx
    use zx
    call QW
    CALL QWW

    e(1:N,1:N)=a(:,:)
    e(1:N,N+1:2*N)=b(:,:)
    e(N+1:2*N,1:N)=c(:,:)
    e(N+1:2*N,N+1:2*N)=d(:,:)

    f(1:N,1:N)=d(:,:)
    f(1:N,N+1:2*N)=c(:,:)
    f(N+1:2*N,1:N)=b(:,:)
    f(N+1:2*N,N+1:2*N)=a(:,:)



    end subroutine xx


    program main
    include 'link_fnl_shared.h'
    use zx
    call xx
    USE LINRG_INT
    USE WRRRN_INT

    CALL LINRG (e, inv_e)

    CALL WRRRN ('inv_e', inv_e)

    end program main




    SUBROUTINE QW
    use zx
    integer :: i,j
    do i=1,N
    do j=1,N
    a(i,j)=3.d0*i+2.d0*j
    end do
    end do

    do i=1,N
    do j=1,N
    b(i,j)=2.d0*i+3.d0*j
    end do
    end do
    END SUBROUTINE QW


    SUBROUTINE QWW
    use zx
    integer :: i,j
    do i=1,N
    do j=1,N
    c(i,j)=6.d0*i+1.d0*j
    end do
    end do

    do i=1,N
    do j=1,N
    d(i,j)=1.d0*i+6.d0*j
    end do
    end do
    END SUBROUTINE QWW
报错如下:
错误      1         error #6236: A specification statement cannot appear in the executable section.                39      
错误      2         error #6236: A specification statement cannot appear in the executable section.                40      




fcode 发表于 2020-4-7 22:04:27

    call xx
    USE LINRG_INT
    USE WRRRN_INT
改为
    USE LINRG_INT
    USE WRRRN_INT
    call xx

call 属于执行语句,在一个程序单元中,执行语句,必须在定义语句的后面。而 use 必须在定义语句的前面。

Botton 发表于 2020-4-8 09:28:54

谢谢,已经解决啦:-lol
页: [1]
查看完整版本: A specification statement cannot appear in the executable section