Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8326109

GCC 13 reports maybe-uninitialized warnings for jni.cpp with dtrace enabled

XMLWordPrintable

    • b05
    • generic
    • linux

      The expansion of the DTRACE_PROBE macros reports a maybe-uninitialized warning with newer versions of GCC (seen with 13.2.1 on 11u).

      In 17u and later, maybe-uninitialized is disabled in CompileJvm.gmk which I suspect is why I don't see the same error there.

      In file included from /localhome/andrew/projects/openjdk/upstream/jdk11u-dev/src/hotspot/share/prims/jni.cpp:88:
      In destructor 'DTraceReturnProbeMark_NewStringUTF::~DTraceReturnProbeMark_NewStringUTF()',
          inlined from '_jstring* jni_NewStringUTF(JNIEnv*, const char*)' at /localhome/andrew/projects/openjdk/upstream/jdk11u-dev/src/hotspot/share/prims/jni.cpp:2524:1:
      /home/andrew/builder/11u-dev/hotspot/variant-server/gensrc/dtracefiles/hotspot_jni.h:4179:1: error: 'ret' may be used uninitialized [-Werror=maybe-uninitialized]
       4179 | DTRACE_PROBE1 (hotspot_jni, NewStringUTF__return, arg1)
            | ^~~~~~~~~~~~~
      /localhome/andrew/projects/openjdk/upstream/jdk11u-dev/src/hotspot/share/utilities/dtrace.hpp:33:24: note: in definition of macro 'DTRACE_ONLY'
         33 | #define DTRACE_ONLY(x) x
            | ^
      /localhome/andrew/projects/openjdk/upstream/jdk11u-dev/src/hotspot/share/prims/jni.cpp:2512:1: note: in expansion of macro 'DT_RETURN_MARK_DECL'
       2512 | DT_RETURN_MARK_DECL(NewStringUTF, jstring
            | ^~~~~~~~~~~~~~~~~~~
      /localhome/andrew/projects/openjdk/upstream/jdk11u-dev/src/hotspot/share/prims/jni.cpp:2513:23: note: in expansion of macro 'HOTSPOT_JNI_NEWSTRINGUTF_RETURN'
       2513 | , HOTSPOT_JNI_NEWSTRINGUTF_RETURN(_ret_ref));
            | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            andrew Andrew Hughes
            andrew Andrew Hughes
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: