<div dir="ltr"><div dir="ltr">Just a heads up, there are even more instances of a method supposed to return a jboolean returning JNI_ERR instead in other places as well, which seems to be fairly concerning:<div><br></div><div><div>=== Output from failing command(s) repeated here ===</div><div>* For target support_test_hotspot_jtreg_native_support_libhs103t002_libhs103t002.o:</div><div>libhs103t002.cpp</div><div>d:\a\jdk\jdk\test\hotspot\jtreg\vmTestbase\nsk\jvmti\scenarios\hotswap\HS103\hs103t002\hs103t002.cpp(156): error C2220: the following warning is treated as an error</div><div>d:\a\jdk\jdk\test\hotspot\jtreg\vmTestbase\nsk\jvmti\scenarios\hotswap\HS103\hs103t002\hs103t002.cpp(156): warning C4305: 'return': truncation from 'int' to 'jboolean'</div><div>d:\a\jdk\jdk\test\hotspot\jtreg\vmTestbase\nsk\jvmti\scenarios\hotswap\HS103\hs103t002\hs103t002.cpp(159): warning C4305: 'return': truncation from 'int' to 'jboolean'</div><div>d:\a\jdk\jdk\test\hotspot\jtreg\vmTestbase\nsk\jvmti\scenarios\hotswap\HS103\hs103t002\hs103t002.cpp(162): warning C4305: 'return': truncation from 'int' to 'jboolean'</div><div> ... (rest of output omitted)</div></div><div><br></div><div>best regards,</div><div>Julian</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Sep 15, 2023 at 3:18 AM Chris Plummer <<a href="mailto:chris.plummer@oracle.com">chris.plummer@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I think it should return false like is does with verify_tag(). This will <br>
cause the test to fail, which it what we would want in this case<br>
<br>
Chris<br>
<br>
On 9/13/23 11:20 PM, David Holmes wrote:<br>
> Hi Julian,<br>
><br>
> This is a serviceability issue - cc'd.<br>
><br>
> On 14/09/2023 12:48 pm, Julian Waters wrote:<br>
>> Hi all,<br>
>><br>
>> In the HotSpot <br>
>> test /test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp, <br>
>> the method occurance_expected, which returns a jboolean, returns <br>
>> JNI_ERR in an error condition. The only place this is used is on line <br>
>> 383, at <br>
>> <a href="https://github.com/openjdk/jdk/blob/11d431b2c436d6b2a0aa7a00d676a93c1b87da0e/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp#L383" rel="noreferrer" target="_blank">https://github.com/openjdk/jdk/blob/11d431b2c436d6b2a0aa7a00d676a93c1b87da0e/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp#L383</a> <br>
>> <<a href="https://github.com/openjdk/jdk/blob/11d431b2c436d6b2a0aa7a00d676a93c1b87da0e/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp#L383" rel="noreferrer" target="_blank">https://github.com/openjdk/jdk/blob/11d431b2c436d6b2a0aa7a00d676a93c1b87da0e/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp#L383</a>>. <br>
>> There is no special handling for the JNI_ERR condition as far as I <br>
>> can tell, and since jboolean is unsigned, the JNI_ERR value of -1 <br>
>> will end up becoming 255 when returning from this method, which is <br>
>> then interpreted as JNI_TRUE on line 385. I caught this after <br>
>> redefining jboolean to bool, which then caused the microsoft compiler <br>
>> to warn about truncating the value. This seems like a bug to me, <br>
>> since I don't think it should return true on an error condition, is <br>
>> there something I'm missing?<br>
><br>
> That's a bug. Unclear whether they intended JNI_FALSE like verify_tag, <br>
> or whether this was really intended to be an error. If it is an error <br>
> then the test should abort somehow.<br>
><br>
> Cheers,<br>
> David<br>
><br>
>> best regards,<br>
>> Julian<br>
</blockquote></div>