The FPP in pgf90 is incorrectly expanding a #defined’d macro. A session log reproducing the problem on a code fragment is below. The definition of NGL is incorrectly being expanded to include a character ‘C’ instead of the numeral 3. I have marked the line containing the error with <<<< . Two other compilers, gfortran and ifort, expand the macro correctly.
$ pgf90 -V
pgf90 18.10-1 64-bit target on x86-64 Linux -tp sandybridge
PGI Compilers and Tools
Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
$ cat bug.F90
#define PORDSTATIC 3
# define NGL ((PORDSTATIC)+1)
# define NPTS (NGL*NGL*NGL)
do ii = 1, NPTS
end do
$ pgf90 -E bug.F90
# 1 "bug.F90"
# 5 "bug.F90"
do ii = 1, (((3)+1)*((C)+1)*((3)+1)) <<< HERE, (C) should be (3)
end do
$ ifort -E bug.F90
# 1 "bug.F90"
do ii = 1, (((3)+1)*((3)+1)*((3)+1))
end do
$ gfortran -E bug.F90
# 1 "bug.F90"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "bug.F90"
do ii = 1, (((3)+1)*((3)+1)*((3)+1))
end do
$ exit
exit