changeset 39411:9b6627406019

8157758: JDK9 does not compile on Linux with GCC 6.1 because left-shifting a negative number has undefined behavior Summary: Replace shifts of -1 with shifts of ~0u. Reviewed-by: kbarrett, mockner Contributed-by: alexhenrie24@gmail.com
author kbarrett
date Thu, 23 Jun 2016 16:46:41 -0400
parents ecedc976bb8b
children 1d5ad28744ca
files hotspot/src/share/vm/code/dependencies.hpp hotspot/src/share/vm/oops/cpCache.hpp
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/src/share/vm/code/dependencies.hpp	Thu Jun 23 16:27:34 2016 +0000
+++ b/hotspot/src/share/vm/code/dependencies.hpp	Thu Jun 23 16:46:41 2016 -0400
@@ -168,7 +168,7 @@
     LG2_TYPE_LIMIT = 4,  // assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT))
 
     // handy categorizations of dependency types:
-    all_types           = ((1 << TYPE_LIMIT) - 1) & ((-1) << FIRST_TYPE),
+    all_types           = ((1 << TYPE_LIMIT) - 1) & ((~0u) << FIRST_TYPE),
 
     non_klass_types     = (1 << call_site_target_value),
     klass_types         = all_types & ~non_klass_types,
--- a/hotspot/src/share/vm/oops/cpCache.hpp	Thu Jun 23 16:27:34 2016 +0000
+++ b/hotspot/src/share/vm/oops/cpCache.hpp	Thu Jun 23 16:46:41 2016 -0400
@@ -193,7 +193,7 @@
     field_index_mask           = right_n_bits(field_index_bits),
     parameter_size_bits        = 8,  // subset of field_index_mask, range is 0..255
     parameter_size_mask        = right_n_bits(parameter_size_bits),
-    option_bits_mask           = ~(((-1) << tos_state_shift) | (field_index_mask | parameter_size_mask))
+    option_bits_mask           = ~(((~0u) << tos_state_shift) | (field_index_mask | parameter_size_mask))
   };
 
   // specific bit definitions for the indices field: