Skip to content

Commit

Permalink
8332904: ubsan ppc64le: c1_LIRGenerator_ppc.cpp:581:21: runtime error…
Browse files Browse the repository at this point in the history
…: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long int'

Reviewed-by: mdoerr, jkern
  • Loading branch information
MBaesken committed May 29, 2024
1 parent 3d4eb15 commit 9b64ece
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/hotspot/cpu/ppc/assembler_ppc.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2024 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -78,9 +78,9 @@ int Assembler::branch_destination(int inst, int pos) {

// Low-level andi-one-instruction-macro.
void Assembler::andi(Register a, Register s, const long ui16) {
if (is_power_of_2(((jlong) ui16)+1)) {
if (is_power_of_2(((unsigned long) ui16)+1)) {
// pow2minus1
clrldi(a, s, 64 - log2i_exact((((jlong) ui16)+1)));
clrldi(a, s, 64 - log2i_exact((((unsigned long) ui16)+1)));
} else if (is_power_of_2((jlong) ui16)) {
// pow2
rlwinm(a, s, 0, 31 - log2i_exact((jlong) ui16), 31 - log2i_exact((jlong) ui16));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ inline bool can_handle_logic_op_as_uimm(ValueType *type, Bytecodes::Code bc) {
is_power_of_2(int_or_long_const) ||
is_power_of_2(-int_or_long_const))) return true;
if (bc == Bytecodes::_land &&
(is_power_of_2(int_or_long_const+1) ||
(is_power_of_2((unsigned long)int_or_long_const+1) ||
(Assembler::is_uimm(int_or_long_const, 32) && is_power_of_2(int_or_long_const)) ||
(int_or_long_const != min_jlong && is_power_of_2(-int_or_long_const)))) return true;

Expand Down

5 comments on commit 9b64ece

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

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

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 9b64ece Jun 7, 2024

Choose a reason for hiding this comment

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

@MBaesken the backport was successfully created on the branch backport-MBaesken-9b64ece5-master in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 9b64ece5 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 29 May 2024 and was reviewed by Martin Doerr and Joachim Kern.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-MBaesken-9b64ece5-master:backport-MBaesken-9b64ece5-master
$ git checkout backport-MBaesken-9b64ece5-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-MBaesken-9b64ece5-master

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 9b64ece Aug 14, 2024

Choose a reason for hiding this comment

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

@MBaesken Could not automatically backport 9b64ece5 to openjdk/jdk17u-dev due to conflicts in the following files:

  • src/hotspot/cpu/ppc/assembler_ppc.cpp

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk17u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk17u-dev.git master:master

# Check out the target branch and create your own branch to backport
$ git checkout master
$ git checkout -b backport-MBaesken-9b64ece5-master

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk.git 9b64ece514cf941ebc727991d97c43453d8a488d

# Backport the commit
$ git cherry-pick --no-commit 9b64ece514cf941ebc727991d97c43453d8a488d
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport 9b64ece514cf941ebc727991d97c43453d8a488d'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u-dev with the title Backport 9b64ece514cf941ebc727991d97c43453d8a488d.

Below you can find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 9b64ece5 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 29 May 2024 and was reviewed by Martin Doerr and Joachim Kern.

Thanks!

Please sign in to comment.