8320353: Reenable stringop-overflow warnings#31025
8320353: Reenable stringop-overflow warnings#31025toxaart wants to merge 2 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back aartemov! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
The total number of required reviews for this PR has been set to 2 based on the presence of this label: |
9c5a4b4 to
d88d61d
Compare
Webrevs
|
|
Hi, just FYI. I just tried building a native fastdebug build with this change on linux-riscv64 using GCC 14. Unfortunately, I found that the previous issue https://bugs.openjdk.org/browse/JDK-8382522 is still triggering. And the build warnings are the same as before: https://bugs.openjdk.org/secure/attachment/119512/build.log |
|
Hi, not a code review. I suppose the previous issue https://bugs.openjdk.org/browse/JDK-8382395 is still triggering. |
|
@RealFYang, @shqking thanks for trying to build it, I identified the 2 problematic places and fixed them. Verified with cross-platform builds. Please give it a try. |
|
FYI In this time, the warning is raised when compiling file |
|
@shqking thanks, I think I missed it, my workspace for some reason have saved --disable-warning-as-errors, which suppressed the problem. I will do yet another pass on all platforms. |
Hi, please consider the following changes:
This PR re-enables stringop-overflow warnings.
It was assumed that the assert in
Thread::current(), which calls theATTRIBUTE_NORETURNreport function on failure, would be sufficient to inform the GCC compiler that the current thread is always non-null. However, it turns out that the assert is weakened by theDebuggingContext:Instead of having
assert(current != nullptr, "Thread::current() called on detached thread");in fact one gets this:
if ( !(DebuggingContext::is_enabled() || current != null) ) { report_vm_error(...); }If
DebuggingContextis enabled then the error will not be triggered regardless of whatcurrentis. This makes GCC consider the virtually impossible path and emit false positive warnings about atomics.The same problem is found in the Shenandoah code.
The fix is to strengthen the assertion by
DEBUG_ONLY(guarantee(current != nullptr, "...");)which removes the assertion completely in product builds, but for debug builds makes it clear for the compiler that the operand cannot be nullptr.
With this findings I conclude that it is not a compiler bug.
Tested in tiers 1-5 and GHA.
Separate builds with Shenandoah done.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31025/head:pull/31025$ git checkout pull/31025Update a local copy of the PR:
$ git checkout pull/31025$ git pull https://git.openjdk.org/jdk.git pull/31025/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 31025View PR using the GUI difftool:
$ git pr show -t 31025Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31025.diff
Using Webrev
Link to Webrev Comment