RFR: JDK-8298448: UndefinedBehaviorSanitizer [v3]

David Holmes dholmes at openjdk.org
Mon Dec 12 07:29:05 UTC 2022


On Mon, 12 Dec 2022 07:02:04 GMT, Justin King <jcking at openjdk.org> wrote:

>> Allow building OpenJDK with UBSan. Currently the build fails when optimizing the image due to lots of undefined behavior (it invokes the built JVM). Follow up PRs will either replace the undefined behavior with well defined behavior or suppress errors which are intentional. The goal is to make OpenJDK more well defined and thus more portable across compilers and architectures.
>
> Justin King has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add comment explaining __ubsan_default_options and UBSAN_OPTIONS
>   
>   Signed-off-by: Justin King <jcking at google.com>

src/java.base/share/native/launcher/main.c line 41:

> 39: // extremely early during library loading, before main is called. We need to override the default
> 40: // options because by default UBSan only prints a warning for each occurrence. We want jtreg tests
> 41: // to fail when undefined behavior is encountered. We also want a full stack trace for the offending

If this is primarily for tests then can't we set the env-var in the test Makefile?

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

PR: https://git.openjdk.org/jdk/pull/11604


More information about the core-libs-dev mailing list