Bug fix for Failed0 error checking functions #2770
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug fix in repeated Failed0 error checking functions
This pull request corrects a bug in the
Failed0error checking functions. Since the bug is repeated exactly, I'm assuming it was present when the function was introduced and then spread by copy / paste throughout. Therefore, while this is likely not causing any issues at the moment, I'm submitting the change to fix it so that it does not continue to spread.Currently, most of the
Failed0functions check for whether the global error, usuallyErrStat, is not 0. However, these functions are primarily used after array allocations with the error status going into the local error, usuallyErrStat2. See the example below. In the currentFailed0, the if-statement to set the error status and message is only entered if the global error is already non-zero, but it is intending to check for whether the local error is set by the allocation.There are two more changes included:
Failed0functions, I also used a consistent case for the error status and error message variables to make it easier to scan for these words. Note that a few instances ofFailed0already had the correct error checking but inconsistent case. I did not modify those.Failed0. Even if the error was caught by the Fortran module, it wouldn't have been sent to the calling code. This is fixed here.