-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8370459: C2: CompressBitsNode::Value produces wrong result on Windows (1UL vs 1ULL), found by ExpressionFuzzer #28062
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
Conversation
|
👋 Welcome back epeter! A progress list of the required criteria for merging this PR into |
|
@eme64 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 46 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
jatin-bhateja
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @eme64,
Your fix looks good to me!
Thanks for addressing this.
Best Regards
TobiHartmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thank you for your persistence on improving our testing! Good that we caught this in-time for JDK 26.
test/hotspot/jtreg/compiler/c2/gvn/TestBitCompressValueTransform.java
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/compiler/c2/gvn/TestBitCompressValueTransform.java
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/compiler/c2/gvn/TestBitCompressValueTransform.java
Outdated
Show resolved
Hide resolved
test/hotspot/jtreg/compiler/c2/gvn/TestBitCompressValueTransform.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Tobias Hartmann <[email protected]>
| // We can further constrain the upper bound of bit compression if the number of bits | ||
| // which can be set(one) is less than the maximum number of bits of integral type. | ||
| hi = MIN2((jlong)((1UL << result_bit_width) - 1L), hi); | ||
| hi = MIN2((jlong)((1ULL << result_bit_width) - 1L), hi); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems weird having - 1L mixed with ULL now. It might be better to use right_n_bits_typed() here and at line 276.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea, I did not know about right_n_bits_typed :)
…com/eme64/jdk into JDK-8370459-expression-fuzz-failure
|
|
|
@dean-long Does it look better now? |
Yes, much better, thanks! |
|
@dean-long @TobiHartmann @jatin-bhateja thanks for the quick reviews! /integrate |
|
Going to push as commit 0ca0852.
Your commit was automatically rebased without conflicts. |
It seems we keep finding issues in
CompressBitsNode::Value, using theTemplateFramework#26885.This is a JDK26 regression of the bugfix #23947, which was itself reported by my prototype of the
TemplateFramework.The bug is simple: On windows
1ULis only a 32-bit value, and not a 64-bit value. We should use1ULLinstead. Impacted lines:jdk/src/hotspot/share/opto/intrinsicnode.cpp
Line 276 in b02c125
jdk/src/hotspot/share/opto/intrinsicnode.cpp
Line 379 in b02c125
This means that simple cases like these wrongly constant fold to zero:
Long.compress(-2683206580L, Integer.toUnsignedLong(x))Long.compress(x, 0xffff_ffffL)This sort of bug (
1ULvs1ULL) is of course very subtle, and easy to miss in a code review. So that is why testing is paramount.Why was this not caught in the testing of #23947? After all there were quite a few tests there, right? There were simply not enough tests, or not the right ones ;)
I did at the time ask for a "range-based" test (#23947 (comment)). I then doubled down and even proposed a conctete test (#23947 (comment)) that would create "range-based" inputs:
What is implortant here: both the
srcandmaskmust have random ranges. But the test that ended up being integrated only made thesrc"range-based" using themin/max. Without themaskbeing tested "range-based", the bug here could not have been caught by that test.I was asked again for my review (#23947 (comment)), but I had to go on vacation, and was not able to catch the issue (#23947).
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28062/head:pull/28062$ git checkout pull/28062Update a local copy of the PR:
$ git checkout pull/28062$ git pull https://git.openjdk.org/jdk.git pull/28062/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28062View PR using the GUI difftool:
$ git pr show -t 28062Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28062.diff
Using Webrev
Link to Webrev Comment