Use var. declared in other module in function declaration


I’m trying to compile this code, but I got an error saying that the variable path_len has not been explicitly declared.
gfortran and xlf are compiling it but not pgfortran.
Is it illegal fortran and pgfortran is right reporting it as an error or is it a bug in pgfortran?
I’m using PGI 18.10, community version.
I compiled it with: pgfortran -c function.f


      module m
        integer, parameter :: path_len = 250
      end module m

      character(len=path_len) function f()
        use m
        implicit none

Hi Judicaël Grasset,

It looks like a compiler error to me. I went ahead and added a problem report (TPR#26937) and sent it to our Fortran compiler team for further investigation.


Hi mkcolg,
Thanks for creating the bug report ticket.
Is there any public bug tracker where I can follow the resolution of this problem?


Hi Judicaël Grasset,

No, sorry. Without going into too much detail, we did try to do this some time ago, but the logistics of maintaining an internal and external database was difficult, coupled with concerns over confidentiality, we decided not to have a public bug tracker. It’s actually why we started the PGI User Forum, any code posted here is implicitly public.

We will update this post once a fix is available in a release and note all fixed issues in our release notes.


Is there any progress on this bug?
(It’s going to prevent the next stable release of the software I’m working on to be compiled with pgi)

Judicaël Grasset

We’ve fixed this with 20.1