Page 1 of 1

NON-standard FORTRAN in fftw3d.f90 causes compile issue

Posted: Thu Sep 24, 2020 4:50 pm
by janfredin
VASP 5.4.4 source fftw3d.f90 has non-standard fortran (real not integer array index) in file fftw3d.f90 creating a compile error with Cray fortran (CCE 10).
> 2501 ftn -ffree -dC -rmo -emEb -O3 -Ofast -hfp3 -O1
> -I/opt/cray/pe/fftw/3.3.8.7/x86_rome/include -c fftw3d.f90
> 2502 ftn-714 crayftn: WARNING in command line
> 2503 The "-O3" command has been overridden by the "-O1" command.
> 2504
> 2505 CR(GRID%NINDPWCONJG(M))=CONJG(C(GRID%IND_IN_SPHERE(M)))*GRID%FFTSCA(GRID%IND_IN_SPHERE(M),2)
> 2506 ^
> 2507 ftn-319 crayftn: ERROR FFTWAV, File = fftw3d.f90, Line = 283, Column = 32
> 2508 A subscript must be a scalar integer expression.
> 2509 ^
> 2510 ftn-319 crayftn: ERROR FFTWAV, File = fftw3d.f90, Line = 283, Column = 63
> 2511 A subscript must be a scalar integer expression.
> 2512 ^
> 2513 ftn-319 crayftn: ERROR FFTWAV, File = fftw3d.f90, Line = 283, Column = 99
> 2514 A subscript must be a scalar integer expression.
> 2515
> 2516 make[2]: *** [makefile:173: fftw3d.o] Error 1

The code is violating this F2018 rule
R919 subscript is scalar-int-expr
Earlier standards have the same rule but under different number, e.g. in F2008 it is R619, etc.

This patch fixes it:
--- fft3dsimple.F.orig 2020-07-29 05:31:36.111646000 -0500
+++ fft3dsimple.F 2020-07-29 05:32:23.633772000 -0500
@@ -240,7 +240,7 @@
!DIR$ IVDEP
!OCL NOVREC
DO M=1,SIZE(GRID%IND_IN_SPHERE)
- CR(GRID%NINDPWCONJG(M))=CONJG(C(GRID%IND_IN_SPHERE(M)))*GRID%FFTSCA(GRID%IND_IN_SPHERE(M),2)
+
+ CR(int(GRID%NINDPWCONJG(M)))=CONJG(C(int(GRID%IND_IN_SPHERE(M))))*GRID
+ %FFTSCA(int(GRID%IND_IN_SPHERE(M)),2)
ENDDO
#endif
ELSE

Please add this correction to any updates.

Re: NON-standard FORTRAN in fftw3d.f90 causes compile issue

Posted: Tue Sep 29, 2020 7:47 am
by henrique_miranda
Hi,

Thanks for your bug report.
This bug has been fixed in VASP6.