--- old/src/hotspot/share/opto/parse2.cpp 2019-07-09 15:20:59.335633878 +0200 +++ new/src/hotspot/share/opto/parse2.cpp 2019-07-09 15:20:59.047633882 +0200 @@ -230,7 +230,7 @@ return; } else if (elemptr->is_valuetypeptr() && !elemptr->maybe_null()) { // Store to non-flattened but flattenable value type array (elements can never be null) - if (!cast_val->is_ValueType()) { + if (!cast_val->is_ValueType() && val_t->maybe_null()) { inc_sp(3); cast_val = null_check(cast_val); if (stopped()) return; @@ -265,7 +265,7 @@ ideal.else_(); { // flattened - if (!cast_val->is_ValueType() && TypePtr::NULL_PTR->higher_equal(val_t)) { + if (!cast_val->is_ValueType() && val_t->maybe_null()) { // Add null check sync_kit(ideal); Node* null_ctl = top();