RFR: 8305922: [aix,linux] Avoid comparing 'this' to nullptr
David Holmes
dholmes at openjdk.org
Fri Apr 21 06:44:42 UTC 2023
On Wed, 12 Apr 2023 18:08:44 GMT, Tyler Steele <tsteele at openjdk.org> wrote:
> This PR removes the remaining 'this' vs. 'nullptr' checks from osThread_linux.cpp and osThread_aix.cpp which cause a build warning on AIX and Linux (when building with Clang). My grepping finds no other occurrences.
>
> As the warning indicates, `this` cannot be `nullptr` in well-formed C++ code. Previous issues have removed these checks, and I believe it makes sense to do so again in these places.
So IIUC the only way this assert could fail would be if an operator new not declared to return null actually did return null - which would be UB.
I will file a RFE so that `new OSThread()` becomes `new (std::nothrow) OSThread()` as allocation failure here should not directly abort the VM.
-------------
Marked as reviewed by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13448#pullrequestreview-1395144560
More information about the hotspot-runtime-dev
mailing list