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

JDK-8290822: C2: assert in PhaseIdealLoop::do_unroll() is subject to undefined behavior #12576

Closed
wants to merge 2 commits into from

Conversation

tobiasholenstein
Copy link
Contributor

@tobiasholenstein tobiasholenstein commented Feb 15, 2023

The following assert had undefined behavior (UB) because of signed integer underflow/overflow:

    assert(stride_con > 0 && ((limit_type->_hi - stride_con) < limit_type->_hi) || 
           stride_con < 0 && ((limit_type->_lo - stride_con) > limit_type->_lo), 
           "sanity"); 

Solution

The fix is to check for underflow/overflow (the purpose of the assert) without actually underflowing/overflowing.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8290822: C2: assert in PhaseIdealLoop::do_unroll() is subject to undefined behavior

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12576/head:pull/12576
$ git checkout pull/12576

Update a local copy of the PR:
$ git checkout pull/12576
$ git pull https://git.openjdk.org/jdk pull/12576/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12576

View PR using the GUI difftool:
$ git pr show -t 12576

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12576.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 15, 2023

👋 Welcome back tholenstein! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Feb 15, 2023

@tobiasholenstein The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Feb 15, 2023
@tobiasholenstein tobiasholenstein marked this pull request as ready for review February 16, 2023 12:13
@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 16, 2023
@mlbridge
Copy link

mlbridge bot commented Feb 16, 2023

Webrevs

Copy link
Contributor

@vnkozlov vnkozlov left a comment

Choose a reason for hiding this comment

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

Looks good.

@openjdk
Copy link

openjdk bot commented Feb 16, 2023

@tobiasholenstein 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:

8290822: C2: assert in PhaseIdealLoop::do_unroll() is subject to undefined behavior

Reviewed-by: kvn, thartmann

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 208 new commits pushed to the master branch:

  • 655a712: 8301444: Port fdlibm hyperbolic transcendental functions to Java
  • b242eef: 8280419: Remove dead code related to VerifyThread and verify_thread()
  • 4ce493f: 8302225: SunJCE Provider doesn't validate key sizes when using 'constrained' transforms for AES/KW and AES/KWP
  • a39cf2e: 8301753: AppendFile/WriteFile has differences between make 3.81 and 4+
  • de80dd9: 8296010: AssertionError in annotationTargetType
  • e5042dd: 8302671: libawt has a memmove decay error
  • 574b48c: 8302678: validate_source fails after JDK-8293313
  • 90e0922: 8293313: NMT: Rework MallocLimit
  • f558a6c: 8298276: JFR: Update NMT events to make use of common periodic timestamp feature
  • a58fa6e: 8302514: Misleading error generated when empty class file encountered
  • ... and 198 more: https://git.openjdk.org/jdk/compare/59b7fb1a91c594f98f06b28cb95310a38565397d...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 16, 2023
Copy link
Member

@TobiHartmann TobiHartmann left a 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 too.

@tobiasholenstein
Copy link
Contributor Author

thanks @vnkozlov and @TobiHartmann !

/integrate

@openjdk
Copy link

openjdk bot commented Feb 17, 2023

Going to push as commit cd77fcf.
Since your change was applied there have been 217 commits pushed to the master branch:

  • 57c9bc3: 8302335: IGV: Bytecode not showing
  • 57fde75: 8302113: Improve CRC32 intrinsic with crypto pmull on AArch64
  • b8c9d6c: 8302158: PPC: test/jdk/jdk/internal/vm/Continuation/Fuzz.java: AssertionError: res: false shouldPin: false
  • dc55a7f: 8302202: Incorrect desugaring of null-allowed nested patterns
  • c4ffe4b: 8301494: Replace NULL with nullptr in cpu/arm
  • 4f1cffd: 8302674: Parallel: Remove unused methods in MutableNUMASpace
  • c91cd28: 8301481: Replace NULL with nullptr in os/windows
  • 47ca577: 8301491: C2: java.lang.StringUTF16::indexOfChar intrinsic called with negative character argument
  • 49eb68b: 8296158: Refactor the verification of CDS region checksum
  • 655a712: 8301444: Port fdlibm hyperbolic transcendental functions to Java
  • ... and 207 more: https://git.openjdk.org/jdk/compare/59b7fb1a91c594f98f06b28cb95310a38565397d...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Feb 17, 2023
@openjdk openjdk bot closed this Feb 17, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Feb 17, 2023
@openjdk
Copy link

openjdk bot commented Feb 17, 2023

@tobiasholenstein Pushed as commit cd77fcf.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-compiler hotspot-compiler-dev@openjdk.org integrated Pull request has been integrated
3 participants