Undeclared allocate fails with ICE

Hi all,

the following code example is erroneous, so that the compiler should quit with a corresponding message. Instead, it fails with an internal compiler error (nvfortran 23.3-0):

module test
   type t1
      integer :: x                                                                            
   end type t1
   type t2                                                                                    
      type(t1), allocatable :: y(:)                                                           
   end type t2                                                                                
  subroutine do_stuff()                                                                       
      allocate (y(1))                                                                         
      !!!allocate (x(1)) -> Invalid type-spec found in ALLOCATE statement                     
   end subroutine do_stuff                                                                    
end module test

The error message is

NVFORTRAN-S-0000-Internal compiler error. check_member: cannot match member with derived type     629  (test.F90: 15)

Note that if the variable y is replaced by another one which does not appear in type t2, e.g. x, the compiler instead fails normally with Invalid type-spec found in ALLOCATE statement.

Thanks for the report Christian. I reproduced the issue here and have reported it as TPR #33666.


1 Like