Internal compiler error in OOP Fortran code

A complex Fortran OOP codebase triggered an internal compiler error, which can be reproduced by the following minimal working example (I’m not sure if this is valid Fortran, but I guess that the corresponding error is undesirable):

 program p
   type, abstract :: mytype
     character(len=1) :: name
     real, dimension(:,:), allocatable :: arr(:)
   end type mytype

   class(mytype), allocatable :: model

   type, abstract, extends(mytype) :: mytype_2
     real, allocatable :: arr_2(:)
   end type mytype_2

   type,extends(mytype_2) :: mytype_3
   end type mytype_3

   allocate(model,source=mytype_3('n'))
 end

When compiling with NVHPC 22.11, I get the following internal error:

 $ nvfortran main.f90
nvfortran-Fatal-/home/pedro/software/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/tools/fort1 TERMINATED by signal 11
Arguments to /home/pedro/software/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/tools/fort1
/home/pedro/software/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/bin/tools/fort1 main.f90 -opt 1 -terse 1 -inform warn -nostatic -x 19 0x400000 -quad -x 59 4 -x 15 2 -x 49 0x400004 -x 51 0x20 -x 57 0x4c -x 58 0x10000 -x 124 0x1000 -tp skylake-avx512 -x 57 0xfb0000 -x 58 0x78031040 -x 47 0x08 -x 48 4608 -x 49 0x100 -stdinc /home/pedro/software/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/include:/home/pedro/software/nvidia/hpc_sdk/Linux_x86_64/22.11/compilers/include-stdexec:/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/include:/usr/local/include:/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/include-fixed:/usr/include -cmdline '+nvfortran main.f90 ' -def unix -def __unix -def __unix__ -def linux -def __linux -def __linux__ -def __NO_MATH_INLINES -def __LP64__ -def __x86_64 -def __x86_64__ -def __LONG_MAX__=9223372036854775807L -def '__SIZE_TYPE__=unsigned long int' -def '__PTRDIFF_TYPE__=long int' -def __amd64 -def __amd64__ -def __k8 -def __k8__ -def __MMX__ -def __SSE__ -def __SSE2__ -def __SSE3__ -def __SSSE3__ -def __ABM__ -def __SSE4_1__ -def __SSE4_2__ -def __AVX__ -def __AVX2__ -def __AVX512F__ -def __AVX512CD__ -def __AVX512VL__ -def __AVX512BW__ -def __AVX512DQ__ -def __F16C__ -def __FMA__ -def __XSAVE__ -def __XSAVEOPT__ -def __XSAVEC__ -def __XSAVES__ -def __POPCNT__ -def __AES__ -def __PCLMUL__ -def __CLFLUSHOPT__ -def __FSGSBASE__ -def __RDRND__ -def __BMI__ -def __BMI2__ -def __LZCNT__ -def __FXSR__ -def __RTM__ -def __PGLLVM__ -def __NVCOMPILER_LLVM__ -def __extension__= -freeform -vect 48 -x 54 1 -x 68 0x1 -x 70 0x40000000 -x 70 0x40000000 -x 68 0x1 -x 124 1 -x 195 0x8000 -y 163 0xc0000000 -x 189 0x10 -stbfile /tmp/nvfortranIL8GbM-Cg-1ni.stb -modexport /tmp/nvfortranYL8Gbw8etL-v6.cmod -modindex /tmp/nvfortrancL8GbgFSm6xEt.cmdx -cci /tmp/nvfortransL8Gb24T3RHsW.cci -output /tmp/nvfortrancL8Gbg42VwJ-v.ilm

Pedro

Thanks for the report Pedro.

I’m not sure if it’s legal or not either though gfortran compiles it fine so I presume it is. Even if it were illegal, the compiler should be giving an error message, definitely not seg faulting. I’ve filed an issue report, TPR #32862, and sent it to engineering for review.

-Mat

2 Likes