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.
Issue
After compiling Mad-X in Debug mode, it crashes when running tracking because of an access to the parameter
z
inBB_Write
intrrun.f90
.Possible Cause
z
is declared with dimensions(6,0)
sinceN_macro_surv
is not set yet (the corresponding branch inBB_Init
isn't taken.When running in Release mode, the check for the declared size of
z
seems to be optimised away and the actual size of the value passed toBB_Write
(presumably(6, jmax)
) is large enough to not trigger a crash.Proposed Solution
Following the example of various other functions, changing the declaration to
z(6,*)
seems to fix this issue.Notes and Open Questions
z
is accessed in multiple functions under the assumption that its dimensions are(6, jmax)
. In this regard, would changing the declaration toz(6,jmax)
be an option?z
before accessing it. This feels a bit unsafe, Is a size of(6, jmax)
guaranteed?