Seemingly erroneous return value in HotSpot test

Julian Waters tanksherman27 at gmail.com
Thu Sep 14 02:48:34 UTC 2023


Hi all,

In the HotSpot
test /test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp,
the method occurance_expected, which returns a jboolean, returns JNI_ERR in
an error condition. The only place this is used is on line 383, at
https://github.com/openjdk/jdk/blob/11d431b2c436d6b2a0aa7a00d676a93c1b87da0e/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp#L383.
There is no special handling for the JNI_ERR condition as far as I can
tell, and since jboolean is unsigned, the JNI_ERR value of -1 will end up
becoming 255 when returning from this method, which is then interpreted as
JNI_TRUE on line 385. I caught this after redefining jboolean to bool,
which then caused the microsoft compiler to warn about truncating
the value. This seems like a bug to me, since I don't think it should
return true on an error condition, is there something I'm missing?

best regards,
Julian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-dev/attachments/20230914/969393e4/attachment.htm>


More information about the hotspot-dev mailing list