RFR(xs): 8210320: PPC64: Fix uninitialized variable in C1 LIR assembler code

Baesken, Matthias matthias.baesken at sap.com
Tue Sep 4 13:48:54 UTC 2018


Hi Gustavo , looks good  (not a reviewer however).
It  might not hurt to initialize   md and data   as well   in the same file  in emit_opTypeCheck  as well  ( even  without gcc complaints ) :


void LIR_Assembler::emit_opTypeCheck(LIR_OpTypeCheck* op) {
  LIR_Code code = op->code();
  if (code == lir_store_check) {
    Register value = op->object()->as_register();
    Register array = op->array()->as_register();
    Register k_RInfo = op->tmp1()->as_register();
    Register klass_RInfo = op->tmp2()->as_register();
    Register Rtmp1 = op->tmp3()->as_register();
    bool should_profile = op->should_profile();

    __ verify_oop(value);
    CodeStub* stub = op->stub();
    // Check if it needs to be profiled.
    ciMethodData* md;
    ciProfileData* data;
 ...



Best regards, Matthias


> -----Original Message-----
> From: ppc-aix-port-dev <ppc-aix-port-dev-bounces at openjdk.java.net> On
> Behalf Of Gustavo Romero
> Sent: Dienstag, 4. September 2018 15:42
> To: hotspot-compiler-dev at openjdk.java.net
> Cc: ppc-aix-port-dev at openjdk.java.net
> Subject: RFR(xs): 8210320: PPC64: Fix uninitialized variable in C1 LIR assembler
> code
> Importance: High
> 
> Hi,
> 
> May I please request reviews for this tiny change that fixes two
> uninitialized variables in PPC64 C1 LIR code?
> 
> Bug   : https://bugs.openjdk.java.net/browse/JDK-8210320
> Webrev: http://cr.openjdk.java.net/~gromero/8210320/v1/
> 
> GCC 4.8 does not complain about these two uninitialized pointers ('data'
> and 'md') but more recent versions, like 5.4.0 and 7.3.1, complain about
> it:
> 
> 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.h
> pp: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:10
> 0: 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.cp
> p:2400:18: note: ‘data’ was declared here
>     ciProfileData* data;
>                    ^
> /home/gromero/hg/jdk/jdk/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cp
> p:2483:78: warning: ‘md’ may be used uninitialized in this function [-
> Wmaybe-uninitialized]
>       type_profile_helper(mdo, mdo_offset_bias, md, data, recv, Rtmp1,
> success);
>                                                                                ^
> 
> Thank you.
> 
> Best regards,
> Gustavo



More information about the hotspot-compiler-dev mailing list