Fortran 在声明的类型中分配参数声明的类型时,ifort出现灾难性错误 请考虑以下代码 module t_test implicit none type ttt(tsize) integer, len :: tsize real x(tsize) end type ttt type :: t_rndom_diameter(t_rsize,t_csize) integer, len :: t_rsize,t_csize real :: x(t_rsize,t_csize) type(ttt(tsize=:)), allocatable :: test_type end type t_rndom_diameter end module t_test program p_test USE t_test implicit none type(t_rndom_diameter(t_rsize=3,t_csize=3)) :: gdad allocate(gdad% ttt(tsize=10) :: gdad % test_type) end program
它给了我一个灾难性的错误,但没有提到错误是什么:Fortran 在声明的类型中分配参数声明的类型时,ifort出现灾难性错误 请考虑以下代码 module t_test implicit none type ttt(tsize) integer, len :: tsize real x(tsize) end type ttt type :: t_rndom_diameter(t_rsize,t_csize) integer, len :: t_rsize,t_csize real :: x(t_rsize,t_csize) type(ttt(tsize=:)), allocatable :: test_type end type t_rndom_diameter end module t_test program p_test USE t_test implicit none type(t_rndom_diameter(t_rsize=3,t_csize=3)) :: gdad allocate(gdad% ttt(tsize=10) :: gdad % test_type) end program,fortran,intel-fortran,Fortran,Intel Fortran,它给了我一个灾难性的错误,但没有提到错误是什么: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not
catastrophic error: **Internal compiler error: segmentation violation signal raised** Please
report this error along with the circumstances in which it occurred in a Software Problem
Report. Note: File and line given may not be explicit cause of this error.
但是,我知道是什么触发了这个错误,即:allocate(gdad%ttt(tsize=10)::gdad%test\u type)
这是什么意思
我还尝试了不使用gdad
,即分配(gdad%ttt(tsize=10)::test\u type)
像往常一样,“内部编译器错误”与编译器中的错误有关。这需要向编译器供应商报告
但是,在这种情况下,这将是一个低优先级的问题:您试图编译的代码无效。如前所述,有问题的一行是
allocate(gdad% ttt(tsize=10) :: gdad % test_type)
这是无效的,因为这种形式的allocate
语句需要左侧的类型说明符gdad%ttt(10)
不是这样的事情。正确的说法是
allocate(ttt(tsize=10) :: gdad % test_type)
如果你认为这篇文章应该被否决,请考虑评论!正如错误消息所述,这是编译器中的错误。这应报告给英特尔,以便修复。此外,您的代码有错误:您试图如何处理该分配?这不是正确的语法,但在不知道您想要什么的情况下,我无法说如何更正它。在allocate语句中,
:
前面的东西必须是一个类型说明符。gdad%ttt(tsize=10)
不是一个。也许您的意思是ttt(10)
(这是一个类型说明符),而不是gdad%ttt(10)
?对于记录,gfortran针对无效代码发出错误消息。如果您尚未这样做,请向英特尔发送问题报告。