hotspot jtreg tests take WARNING_CFLAGS_JDK_CONLY flags

Baesken, Matthias matthias.baesken at sap.com
Thu Jul 10 15:23:48 UTC 2025


When  trying the GCC static analyzer (-fanalyzer flag)


diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4
index e80d9a98957..9d1ae60047b 100644
--- a/make/autoconf/flags-cflags.m4
+++ b/make/autoconf/flags-cflags.m4
@@ -610,7 +610,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
   # CFLAGS WARNINGS STUFF
   # Set JVM_CFLAGS warning handling
   if test "x$TOOLCHAIN_TYPE" = xgcc; then
-    WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS"
+    # enable -fanalyzer (but better only for gcc12 + , and also only for C)
+    # too many strange / shaky fd leak warnings
+    WARNING_CFLAGS_JDK_CONLY="-fanalyzer -Wno-analyzer-fd-leak $WARNINGS_ENABLE_ALL_CFLAGS"
     WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
     WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS"

I noticed that the   WARNING_CFLAGS_JDK_CONLY  go into the  hotspot   jtreg tests, e.g.  :


/jdk/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h:46:6: error: dereference of NULL '0' [CWE-476] [-Werror=analyzer-null-dereference]
   46 |   *x = 34; // Crash
      |   ~~~^~~~
  'dereference_null': event 1
    |
    |   46 |   *x = 34; // Crash
    |      |   ~~~^~~~
    |      |      |
    |      |      (1) dereference of NULL '0'


This might be intended but   I was surprised that the HS  C tests take  WARNING_CFLAGS_JDK_CONLY    !?   Is this intended or not ?


Best regards, Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-dev/attachments/20250710/288285aa/attachment-0001.htm>


More information about the hotspot-dev mailing list