【发布时间】:2012-10-08 12:12:05
【问题描述】:
这个问题与我之前的问题有关:How to force compiler to interpret omitted intent as intent(inout)。将遗漏的意图解释为意图(inout)似乎是不可能的,因此违反意图(in)的问题仍然存在。
同样的例子:
module test
implicit none
contains
subroutine fun1(x)
real(8), intent(in)::x
call fun2(x)
end subroutine
subroutine fun2(x)
real(8) :: x
x = 10
end subroutine
end module
gfortran 和 ifort 可以编译此代码而不会出现任何错误/警告。所以我的问题是:
当intent(in) 变量被传递给带有省略意图(但声明接口)的子例程时,如何强制fortran 编译器生成错误?
【问题讨论】:
-
选择一个实现此测试的处理器/麻烦或向您的供应商付费以添加此功能/修改现有的开源编译器/编写您自己的编译器。
标签: fortran