Skip to content

Commit 4abb5e4

Browse files
alexhenrieKim Barrett
authored andcommitted
8157758: JDK9 does not compile on Linux with GCC 6.1 because left-shifting a negative number has undefined behavior
Replace shifts of -1 with shifts of ~0u. Reviewed-by: kbarrett, mockner
1 parent dd9f85e commit 4abb5e4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

hotspot/src/share/vm/code/dependencies.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class Dependencies: public ResourceObj {
168168
LG2_TYPE_LIMIT = 4, // assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT))
169169

170170
// handy categorizations of dependency types:
171-
all_types = ((1 << TYPE_LIMIT) - 1) & ((-1) << FIRST_TYPE),
171+
all_types = ((1 << TYPE_LIMIT) - 1) & ((~0u) << FIRST_TYPE),
172172

173173
non_klass_types = (1 << call_site_target_value),
174174
klass_types = all_types & ~non_klass_types,

hotspot/src/share/vm/oops/cpCache.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_CLASS_SPEC {
193193
field_index_mask = right_n_bits(field_index_bits),
194194
parameter_size_bits = 8, // subset of field_index_mask, range is 0..255
195195
parameter_size_mask = right_n_bits(parameter_size_bits),
196-
option_bits_mask = ~(((-1) << tos_state_shift) | (field_index_mask | parameter_size_mask))
196+
option_bits_mask = ~(((~0u) << tos_state_shift) | (field_index_mask | parameter_size_mask))
197197
};
198198

199199
// specific bit definitions for the indices field:

0 commit comments

Comments
 (0)