Skip to content

Fix some errors find by Address Sanitizer #1795

Open
foxtran wants to merge 4 commits intoNOAA-GFDL:mainfrom
foxtran:fix/ASan
Open

Fix some errors find by Address Sanitizer #1795
foxtran wants to merge 4 commits intoNOAA-GFDL:mainfrom
foxtran:fix/ASan

Conversation

@foxtran
Copy link
Copy Markdown
Contributor

@foxtran foxtran commented Nov 21, 2025

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

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

Checklist:

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

Copy link
Copy Markdown
Contributor

@uramirez8707 uramirez8707 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for fixing these.

@thomas-robinson
Copy link
Copy Markdown
Member

@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.

@foxtran
Copy link
Copy Markdown
Contributor Author

foxtran commented Dec 9, 2025

We are interested to hear how you are using FMS

I'm playing with flang frontend :-)

@foxtran
Copy link
Copy Markdown
Contributor Author

foxtran commented Dec 9, 2025

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

@foxtran
Copy link
Copy Markdown
Contributor Author

foxtran commented Jan 30, 2026

@uramirez8707, can it be merged?

@foxtran
Copy link
Copy Markdown
Contributor Author

foxtran commented Jan 30, 2026

@rem1776, could you please have a look on it?

@foxtran
Copy link
Copy Markdown
Contributor Author

foxtran commented Feb 4, 2026

@rem1776, @uramirez8707, any chance that it will be merged? :D

@rem1776
Copy link
Copy Markdown
Contributor

rem1776 commented Feb 5, 2026

@bensonr Could you take a look at this when you get a chance?

Copy link
Copy Markdown
Contributor

@bensonr bensonr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies. While I performed the review shortly after the PR was entered, I see I never formally submitted it. Please see my comment regarding the chosen missing value.

sample = 1
weight = 1.0
missvalue = 1.0e-5
missvalue = 1.0e-5_r4_kind
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you aren't the original author here, but I see a deeper problem with the chosen assignment value. At line 150, there is the possibility for missvalue to be typed as an i8 and associated with an i8 pointer leading to an invalid value.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understood, missvalue can be both real(4) or integer(8). So, this assignment can change type of missvalue that invalidates missval_i8_ptr, defined at line 150, although data still be accessible via missval_i8_ptr.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a shorter example how does it work: https://godbolt.org/z/5jW4P9oY4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants