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: clanger
Backport-of: 9b64ece514cf941ebc727991d97c43453d8a488d
  • Loading branch information
MBaesken committed Aug 30, 2024
1 parent a9d755c commit acfce69
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, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015 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 @@ -79,9 +79,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 @@ -582,7 +582,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

1 comment on commit acfce69

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.