提问人:Rasmus 提问时间:9/15/2023 最后编辑:Rasmus 更新时间:9/15/2023 访问量:105
这是英特尔 Fortran 编译器中的错误吗?
Is this a bug in the Intel Fortran compiler?
问:
我通过举一个最小的例子,重现了使用英特尔 Fortran 编译器 ifort 编译代码时遇到的一些奇怪行为。这种奇怪的行为也出现在较新的英特尔编译器 ifx 上。
使用 ifort 版本 2021.10.0 或 ifx 版本 2023.2.0 编译以下代码。
ifort minimal_example.f90
或
ifx minimal_example.f90
minimal_example.f90
subroutine f(n)
implicit none
integer, intent(in) :: n
real :: x(n)
real :: y(n)
real :: z(n)
call g(z, y)
contains
subroutine g(z, y)
real, intent(in) :: z(size(x))
real, intent(out) :: y(n)
print*, 'n = ', n
print*, 'size(y) = ', size(y)
end subroutine
end subroutine
program minimal_example
implicit none
external f
call f(8)
end program
我得到输出:
n = 8
size(y) = 0
使用 gfortran,我得到:
n = 8
size(y) = 8
这是两个英特尔 Fortran 编译器中的错误吗?
如果我用 n 替换 size(x),奇怪的行为就会消失。但我认为使用 size(x) 应该是有效的。
答: 暂无答案
评论