Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Catastrophic error with ifort when allocating parametric declared type within a declared type

Please consider following code

  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

it gives me a catastrophic error without mentioning what the error is:

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.

However, I know what triggers this error, namely: allocate(gdad% ttt(tsize=10) :: gdad% test_type)

What does this mean?

I also tried without gdad, i.e. allocate(gdad% ttt(tsize=10) :: test_type)

like image 815
ATK Avatar asked Oct 28 '22 21:10

ATK


1 Answers

As usual, an "internal compiler error" relates to a bug in the compiler. This is something to report to the compiler vendor.

However, in this case it would be a low priority problem: the code you are attempting to compile is invalid. As noted, the problematic line is

allocate(gdad% ttt(tsize=10) ::  gdad % test_type)

This is invalid because this form of the allocate statement requires a type specifier on the left-hand side. gdad%ttt(10) is not such a thing. The correct statement would be

allocate(ttt(tsize=10) ::  gdad % test_type)
like image 173
francescalus Avatar answered Nov 01 '22 19:11

francescalus