PGI pgfortran 18.4 produces error in LLVM IR code


I get the following error from ‘opt’:

$ wget
$ pgfortran --version

pgfortran 18.4-0 LLVM 64-bit target on x86-64 Linux -tp haswell 
PGI Compilers and Tools
Copyright (c) 2018, NVIDIA CORPORATION.  All rights reserved.
$ pgfortran -c jacobi.f90
/home/wesarg/opt/pgi-18.4/linux86-64-llvm/18.4/share/llvm/bin/opt: jacobi.ll:1430:7: error: expected metadata type
!65 = !DIFortranSubrange(constLowerBound: 1, upperBound: !63, upperBoundExpression: !64)


Sorry, this is invalid. See solution in