Fix some errors find by Address Sanitizer #1795
Open
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.
Description
AddressSanitizer detected some errors which I've fixed here:
mpp_domain_misc:mpp_sendis non-blocking operation so,send_buffermust be alive at least until sync point. (Closesmpp_check_field_2d_type1has use after free #1803)mpp_utils_mpi: in-place writing may give errors (not sure that it really happens here, but anyway)test_diag_update_buffeer:-fdefault-real-8generates1.0e-5asreal(8). Then,real(8)constructor ofmissvalueis called while it isreal(4). So, 4 extra bytes were written. (Closestest_diag_update_manager: wrong datatype is set with-fdefault-real-8#1805)test_xgrid:put_to_xgridkept address of local/temporary variables generated byarray + xexpressions. Now, lifetimes ofarray + xarrays are expanded. That is why after Remove cray pointers fromexchange/xgrid.f90#1778 there is a lot failures of CI. (Closestest_xgridkeeps local temporaries (use after free) #1804)How Has This Been Tested?
Tested in CI with AddressSanitizer. Unfortunately, not all Address Sanitizer errors are fixed.
Checklist:
make distcheckpasses