Internal compiler error (nvfortran) with implied-shape arrays


when i try to compile the following minimal example code:

module module1
    implicit none

    character(len=12), parameter, private :: dim_list(*) = [ &
        'DIM_LON     ', &
        'DIM_LAT     ', &
        'DIM_LEV     ', &
        'DIM_TIME    ', &
        'DIM_XSTAGE  ', &
        'DIM_YSTAGE  ', &
        'DIM_ZSTAGE  ', &
        'DIM_SOILAY  ']
end module

module module2
    use module1
    implicit none

    integer, parameter, private :: my_parameter = 1
end module

program main
    use module2
    implicit none

    write(*,*) "done!"

end program main


nvfortran -c module1.f90
nvfortran -c module2.f90
nvfortran -c main.f90

I’m getting the following compiling error in the last step:

NVFORTRAN-F-0000-Internal compiler error. module:new_dtype, dt nfd      60  (main.f90: 3)
NVFORTRAN/x86-64 Linux 22.11-0: compilation aborted

Note that the following main program works (using module1 instead of module2):

program main
    use module1
    implicit none

    write(*,*) "done!"

end program main

It was tested it with different versions, including:

$ nvfortran --version

nvfortran 22.11-0 64-bit target on x86-64 Linux -tp haswell 
NVIDIA Compilers and Tools
Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES.  All rights reserved.

The problem seems to be related to implied-shape arrays and nested modules… if I explicitly define the array shape (dim_list(8)) in module1, the main program is compiled without errors (and it works)…

Could it be a compiler bug?

Thanks for your help

Hi imingari,

Thanks for the report and the nice reproducing example. I’ve filed an issue report, TPR#34694, and sent it to engineering for review.

Hopefully the work around of using a fixed size array will be sufficient in the mean time.

Best Regards,