RFR: 8320353: Reenable stringop-overflow warnings
Kim Barrett
kbarrett at openjdk.org
Thu Jul 3 01:32:53 UTC 2025
On Wed, 2 Jul 2025 13:51:24 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Hi, please consider the following changes:
>>
>> this PR addresses the issue of stringop-overflow warnings produced by GCC. The compiler does think that the thread pointer returned by `JavaThread::current()` can be null, though it cant. The thread pointer ends up being an argument in `__atomic_load`, and the compiler reports the warning related to argument of that method.
>>
>> The patch adds a hint to the compiler by means of `__builtin_unreachable()` intrinsic, which tells the compiler that certain piece of code will never be reached (case of thread pointer being null). This solves the issue.
>>
>> Tested in tiers 1-3 and GHA.
>
> src/hotspot/share/jvmci/jvmciCodeInstaller.cpp line 936:
>
>> 934: __builtin_unreachable();
>> 935: }
>> 936: #endif
>
> I think this could be replaced with asserting non-null. A failed assert calls a noreturn reporting
> function.
Although I wonder why the assert in Thread::current() isn't sufficient? Maybe non-null info isn't
propagating through the cast to JavaThread?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26067#discussion_r2181311538
More information about the build-dev
mailing list