Warning at compilation due to potentially uninitialised variable
A warning is produced by GCC Fortran compiler while installing airGR version 1.6.9.27, due to a may be uninitialized variable.
How to reproduce the bug?
- Clone master branch of repository at commit
88db83a415ac97742353fc06245c40255535f6e7
- Run
R CMD build airgr
- Run
R CMD INSTALL airGR_1.6.9.27.tar.gz
Used software: openSUSE Leap 15.2 with Linux 5.3.18-lp152.60-default kernel; GNU Fortran 11.0.0 20210122 for SUSE Linux; R version 4.0.3
Compilation flags: -fno-optimize-sibling-calls -fpic -std=f2018 -fmessage-length=0 -grecord-gcc-switches -O3 -Wall -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection
Expected behaviour
Compilation and installation without warning.
Actual behaviour
Warning while compiling frun_GR5H.f90
:
gfortran -fno-optimize-sibling-calls -fpic -std=f2018 -fmessage-length=0 -grecord-gcc-switches -O3 -Wall -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -c frun_GR5H.f90 -o frun_GR5H.o
frun_GR5H.f90:93:26:
93 | IF (IsIntStore .EQV. .TRUE.) St(3) = StateStart(4)
| ^
Avertissement: « isintstore » may be used uninitialized [-Wmaybe-uninitialized]
frun_GR5H.f90:71:27:
71 | logical :: IsIntStore ! TRUE if interception store is used, FALSE otherwise
| ^
note: « isintstore » déclaré ici
Proposed solution
Change lines 79 and 80 of frun_GR5H.f90
to an if-else statement:
IF (Imax .LT. 0.) THEN
IsIntStore = .FALSE.
ELSE
IsIntStore = .TRUE.
ENDIF