FMS icon indicating copy to clipboard operation
FMS copied to clipboard

Fix some errors find by Address Sanitizer

Open foxtran opened this issue 3 months ago • 3 comments

Description AddressSanitizer detected some errors which I've fixed here:

  • mpp_domain_misc: mpp_send is non-blocking operation so, send_buffer must be alive at least until sync point. (Closes #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-8 generates 1.0e-5 as real(8). Then, real(8) constructor of missvalue is called while it is real(4). So, 4 extra bytes were written. (Closes #1805)
  • test_xgrid: put_to_xgrid kept address of local/temporary variables generated by array + x expressions. Now, lifetimes of array + x arrays are expanded. That is why after #1778 there is a lot failures of CI. (Closes #1804)

How Has This Been Tested? Tested in CI with AddressSanitizer. Unfortunately, not all Address Sanitizer errors are fixed.

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] Any dependent changes have been merged and published in downstream modules
  • [x] New check tests, if applicable, are included
  • [x] make distcheck passes

foxtran avatar Nov 21 '25 00:11 foxtran

@foxtran Can you open an issue that describes what you are fixing and why and link it to this PR. It helps us with tracking.

Also, just out of curiosity, do you have a use case for FMS that we don't know about. We are interested to hear how you are using FMS.

thomas-robinson avatar Dec 09 '25 13:12 thomas-robinson

We are interested to hear how you are using FMS

I'm playing with flang frontend :-)

foxtran avatar Dec 09 '25 13:12 foxtran

@thomas-robinson, I filed 2 of 4 bugs. Ping me, please, tomorrow, if I will not put other 2 until tomorrow.

foxtran avatar Dec 09 '25 13:12 foxtran