Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

real loop indexes used in mbpf #757

Closed
dkokron opened this issue Jun 18, 2024 · 6 comments · Fixed by #760
Closed

real loop indexes used in mbpf #757

dkokron opened this issue Jun 18, 2024 · 6 comments · Fixed by #760
Assignees

Comments

@dkokron
Copy link

dkokron commented Jun 18, 2024

GDIT is testing a static analysis tool called Codee (https://www.codee.com/). Codee flagged some issues with mgbf.

codee: error: failed to analyze '/lfs/h1/hpc/support/USER/Projects/GSI/develop/src/mgbf/mg_input.f90'

error: Semantic errors in /lfs/h1/hpc/support/USER/Projects/GSI/develop/src/mgbf/mg_input.f90
/lfs/h1/hpc/support/USER/Projects/GSI/develop/src/mgbf/mg_input.f90:67:12: error: Must have INTEGER type, but is REAL(4)
V(n,m)=ampl*(mgimax0+ng)
^
/lfs/h1/hpc/support/USER/Projects/GSI/develop/src/mgbf/mg_input.f90:67:14: error: Must have INTEGER type, but is REAL(4)
V(n,m)=ampl
(mgimax0+ng)
^
/lfs/h1/hpc/support/USER/Projects/GSI/develop/src/mgbf/mg_input.f90:145:12: error: Must have INTEGER type, but is REAL(4)
V(l,n,m)=ampl
(mgimax0+ng) +(l-1)incrm
^
/lfs/h1/hpc/support/USER/Projects/GSI/develop/src/mgbf/mg_input.f90:145:14: error: Must have INTEGER type, but is REAL(4)
V(l,n,m)=ampl
(mg
imax0+ng) +(l-1)incrm
^
/lfs/h1/hpc/support/USER/Projects/GSI/develop/src/mgbf/mg_input.f90:145:16: error: Must have INTEGER type, but is REAL(4)
V(l,n,m)=ampl
(mg*imax0+ng) +(l-1)*incrm

The l,n,m variables are loop indexes but they are declared.
real(i_kind):: ng,mg,L,m,n

@TingLei-NOAA
Copy link
Contributor

@dkokron Thanks for this validation effort. The apparent fix is to use " integer(i_kind)" to replace "real(i_kind)".
I think you can direct make a PR for this or I can do it if you prefer.
Please let me know how you want to proceed. Thanks.
BTW: it is mgbf rather than "mbpf".

@dkokron
Copy link
Author

dkokron commented Jun 21, 2024

@TingLei-NOAA Please submit the PR for this issue.

TingLei-daprediction pushed a commit to TingLei-daprediction/GSI that referenced this issue Jun 23, 2024
…ich was identified by D. Kokron. NOAA-EMC#757 .    Co-author : D. Kokron
@dkokron
Copy link
Author

dkokron commented Jul 11, 2024 via email

@TingLei-NOAA
Copy link
Contributor

@dkokron You identified the problem and created the issue and you are also the coauthor for that PR. Finally, if you are satisfied the solution when the PR is finally merged into the develop branch, you could close this issue as the assignee.

@TingLei-daprediction
Copy link
Contributor

An update: the PR with the quick fix for the issue had been closed and will be re-opened pending on future mgbf upgrading (#760).
It is also noted the program causing the safety concern identified in this would only be used when the mgbf package is used as the stand-alone version using its own driver and initialization blocks(which would invoke this code).

@RussTreadon-NOAA
Copy link
Contributor

PR #760 was closed because there was no timeline for working on the PR. This issue will remain open until the bug is fixed. Clearly the declaration of integer(i_kind) variables as real(i_kind) in src/mgbf/mg_input.f90 is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants