Fortran polymorphic type issue with 19.4


I am encountering an issue when using polymorphic types in modern fortran. I have a routine that takes in a string and a variable that is declared in the routine as class(*). I then use select type to then select the type of var and convert the string to the variable.

I, however, encounter problems when using allocatable arrays in a particular set of circumstances. A simple example code that reproduces the error can be found here.

This error has only occurred since upgrading to pgfortran 19.4, compared to say 19.1. When compiled with -O0 there isn’t an issue, but when I use -O1 or higher I get the error FIO-F-225/list-directed read/internal file/lexical error-- unknown token type.

Any suggestions would be great.


p.s. I’m aware I could probably use pattern matching in an explicit interface in this example, but due to other dependancies on read_str2polymorphic that wouldn’t be an option in the production code.

Hi wtrojak23087,

Thanks for the report and reproducing example! I was able to recreate the issue and have submitted a problem report (TPR#27267). Our compiler engineers will take a look as see what’s going wrong.

The error only occurs with our LLVM back-end which was made the default as of PGI 19.1. Hence as work-around, you can use our non-LLVM back-end by either adding the flag “-Mnollvm” or setting your compiler PATH to “$PGI/linux86-64-nollvm/19.4/bin”.


Thanks, I changed to using linux86-64-nollvm and that sorted out the problem.