Skip to content

0.51: Fix bug in TR_IPBCDataFourBytes::getSumBranchCount #21280

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

Merged

Conversation

dsouzai
Copy link
Contributor

@dsouzai dsouzai commented Mar 5, 2025

Cherry-pick of #21274

TR_IPBCDataFourBytes::getSumBranchCount returns the sum of the two
branch counters. Internally these are stored as two 16 bit integers.
getSumBranchCount is called only by TR_IProfiler::getSamplingCount which
returns a int32_t. However, TR_IPBCDataFourBytes::getSumBranchCount sums
up the two 16 bit integers as uint16_ts and returns a int16_t. This has
the consequence of sometimes returning a negative number because of
overflow.

This commit fixes this by consistently using int32_t.

Signed-off-by: Irwin D'Souza <[email protected]>
@dsouzai
Copy link
Contributor Author

dsouzai commented Mar 5, 2025

@mpirvu

Copy link
Contributor

@mpirvu mpirvu left a comment

Choose a reason for hiding this comment

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

LGTM. No testing needed.

@mpirvu mpirvu merged commit 26449cd into eclipse-openj9:v0.51.0-release Mar 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants