RFR: 8265431: Add -fdelete-null-pointer-checks to clang builds

Maxim Kartashev github.com+28651297+mkartashev at openjdk.java.net
Tue Jun 1 14:20:22 UTC 2021


On Tue, 1 Jun 2021 13:23:49 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> I left a comment in the bug that you haven't answered.

Sorry, don't have write access to the bug. 

To answer your comment
> You seem to be mixing up -fno-delete-null-pointer-checks and -fdelete-null-pointer-checks between the description text and the bug title. Which one is it? 

I meant `-fno-delete-null-pointer-checks`, which is _not_ the default and which is why it needs to be specified explicitly. This piece is from the [clang command line reference](https://clang.llvm.org/docs/ClangCommandLineReference.html):

-fdelete-null-pointer-checks, -fno-delete-null-pointer-checks

Treat usage of null pointers as undefined behavior (default)

Without `-fno-delete-null-pointer-checks`, starting from clang 12 `this` pointer will be assumed to never be null, which it sometimes is in the JVM code. And we don't want this to be treated as undefined behavior because that would give the compiler too much freedom in transforming the code, quite possibly destroying the intent of the author of said code.

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

PR: https://git.openjdk.java.net/jdk/pull/4166



More information about the build-dev mailing list