RFR (XS) 8161280 - assert failed: reference count underflow for symbol

Andrew Haley aph at redhat.com
Sun Aug 28 20:03:48 UTC 2016

On 26/08/16 19:05, Kim Barrett wrote:

> It seems my attempt at clarification has led to further confusion.
> Recent discussion in this thread has been focused on the right shift,
> e.g. assuming it "does the right thing".
> The left shift is *broken*.  Recent versions of gcc *will* do
> something other than what is being expected.  We've already seen
> reports of (and fixed) problems encountered by folks using gcc6 for
> exactly this sort of thing.  See, for example, JDK-8157758.
> In the specific case at hand, the compiler can trivially prove that
> undefined behavior is being invoked, because of the constant -1 being
> passed to an inline function where the shift occurs. What it does from
> there is anyone's guess; gcc6 seems to be treating such things as
> unreachable code and optimizing accordingly.

GCC supports shifting left negative integers:

"4.5 Integers

"As an extension to the C language, GCC does not use the latitude
given in C99 and C11 only to treat certain aspects of signed ‘<<’ as
undefined. However, ‘-fsanitize=shift’ (and ‘-fsanitize=undefined’)
will diagnose such cases. They are also diagnosed where constant
expressions are required."


More information about the hotspot-runtime-dev mailing list