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

PPC64: Fix uninitialized variable in C1 LIR assembler code

XMLWordPrintable

    • b10
    • ppc
    • linux

        The following compiler warning/error will be triggered when JVM is compiled with recent gcc compilers (>=7.3):

        Compiling 395 files for BUILD_jdk.compiler.interim
        In file included from /home/gromero/hg/jdk/jdk/src/hotspot/share/c1/c1_Compilation.hpp:29:0,
                         from /home/gromero/hg/jdk/jdk/src/hotspot/share/precompiled/precompiled.hpp:286:
        /home/gromero/hg/jdk/jdk/src/hotspot/share/ci/ciMethodData.hpp: In member function ‘void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck*, Label*, Label*, Label*)’:
        /home/gromero/hg/jdk/jdk/src/hotspot/share/ci/ciMethodData.hpp:595:100: warning: ‘data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           int byte_offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data) { return in_bytes(offset_of_slot(data, slot_offset_in_data)); }
                                                                                                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /home/gromero/hg/jdk/jdk/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp:2400:18: note: ‘data’ was declared here
           ciProfileData* data;
                          ^~~~
        In file included from /home/gromero/hg/jdk/jdk/src/hotspot/share/c1/c1_Compilation.hpp:29:0,
                         from /home/gromero/hg/jdk/jdk/src/hotspot/share/precompiled/precompiled.hpp:286:
        /home/gromero/hg/jdk/jdk/src/hotspot/share/ci/ciMethodData.hpp:595:100: warning: ‘md’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           int byte_offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data) { return in_bytes(offset_of_slot(data, slot_offset_in_data)); }
                                                                                                    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /home/gromero/hg/jdk/jdk/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp:2399:17: note: ‘md’ was declared here
           ciMethodData* md;
                         ^~


        The following trivial fix will resolve the issue:

         @@ -141637,7 +141637,7 @@ void LIR_Assembler::emit_typecheck_helper(LIR_OpTypeCheck *op, Label* success, L
            }
          
            ciMethodData* md;
         - ciProfileData* data;
         + ciProfileData* data=0;
            int mdo_offset_bias = 0;
            if (should_profile) {
              ciMethod* method = op->profiled_method();

              gromero Gustavo Romero
              gromero Gustavo Romero
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: