Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix queryktharr() return value/behaviour. #4186

Conversation

philip-blakely
Copy link
Contributor

Summary

Up to AMReX 24.07 (at least), ParmParse::queryktharr() used to return 0 if the given k (2nd parameter) was out of range.
As of AMReX 24.10, this is not the case, and ppindex() attempts to access found->second.m_vals out-of-bounds, resulting in seg-fault/undefined behaviour.

This PR reverts to the original behaviour, which is now consistent with the documentation for querykth() in AMReX_ParmParse.H. It also makes minor corrections to the associated comments to align with this behaviour.

Additional background

Checklist

The proposed changes:

  • fix a bug or incorrect behavior in AMReX
  • add new capabilities to AMReX
  • changes answers in the test suite to more than roundoff level
  • are likely to significantly affect the results of downstream AMReX users
  • include documentation in the code and/or rst files, if appropriate

if the given k (2nd parameter) was out of range.
As of AMReX 24.10, this is not the case, and ppindex()
attempts to access found->second.m_vals out-of-bounds, resulting in
seg-fault/undefined behaviour.

This commit reverts to the original behaviour, which is now consistent
with that for querykth().
It also makes minor corrections to the associated documentation.
@WeiqunZhang WeiqunZhang merged commit bd56c53 into AMReX-Codes:development Oct 9, 2024
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants