【发布时间】:2020-06-07 23:26:01
【问题描述】:
考虑以下代码:
subroutine tao_show_this ()
implicit none
type b_struct
integer, pointer :: good_user => null()
end type
type a_struct
type (b_struct), allocatable :: value_ptr(:)
end type
type (a_struct) a
a = a_struct()
end subroutine
用 gfortran 5 或 7 编译得到:
gfortran -c test.f90
test.f90:4:13:
type b_struct
1
Error: The rank of the element in the structure constructor at (1) does not match that of the component (0/1)
这段代码用 ifort 编译得很好。这是 gfortran 错误还是我的代码有问题?
【问题讨论】:
-
向 gcc 报告错误:gcc.gnu.org/bugzilla/show_bug.cgi?id=87568。标记为“从 4.8 到主干 (9.0) 已确认。”