On Tue, 1 Jul 2025 12:25:04 GMT, Anton Artemov <d...@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.

Sorry but I really dislike seeing this compiler-specific pollution in shared 
code. It is even worse that you have to put it in two places (what is so 
special about the jvmci code to require this?) just because gcc is "too dumb" 
keep track of things.

Also IIUC from JBS the problem was only seen building Zero, so maybe we can do 
something there that is Zero specific?

Sorry.

-------------

PR Review: https://git.openjdk.org/jdk/pull/26067#pullrequestreview-2977963403

Reply via email to