8139040: Fix initializations before ShouldNotReachHere() etc. and enable -Wuninitialized on linux.
authorgoetz
Thu, 22 Oct 2015 13:07:10 -0400
changeset 33589 7cbd1b2c139b
parent 33580 c2d95df2c54e
child 33590 338b512e9b40
8139040: Fix initializations before ShouldNotReachHere() etc. and enable -Wuninitialized on linux. Reviewed-by: stuefe, coleenp, roland
hotspot/agent/src/os/linux/symtab.c
hotspot/make/linux/makefiles/gcc.make
hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp
hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp
hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp
hotspot/src/os/linux/vm/os_linux.cpp
hotspot/src/os_cpu/linux_x86/vm/copy_linux_x86.inline.hpp
hotspot/src/share/vm/c1/c1_Canonicalizer.cpp
hotspot/src/share/vm/c1/c1_GraphBuilder.cpp
hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
hotspot/src/share/vm/c1/c1_LIRGenerator.hpp
hotspot/src/share/vm/ci/ciObjectFactory.cpp
hotspot/src/share/vm/classfile/classFileParser.cpp
hotspot/src/share/vm/classfile/compactHashtable.cpp
hotspot/src/share/vm/classfile/placeholders.hpp
hotspot/src/share/vm/compiler/oopMap.hpp
hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp
hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp
hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp
hotspot/src/share/vm/interpreter/templateInterpreter.cpp
hotspot/src/share/vm/memory/allocation.cpp
hotspot/src/share/vm/opto/callGenerator.cpp
hotspot/src/share/vm/opto/compile.cpp
hotspot/src/share/vm/opto/compile.hpp
hotspot/src/share/vm/opto/generateOptoStub.cpp
hotspot/src/share/vm/opto/lcm.cpp
hotspot/src/share/vm/opto/library_call.cpp
hotspot/src/share/vm/opto/macro.cpp
hotspot/src/share/vm/opto/parse1.cpp
hotspot/src/share/vm/opto/split_if.cpp
hotspot/src/share/vm/opto/superword.cpp
hotspot/src/share/vm/prims/jvmtiEnter.xsl
hotspot/src/share/vm/prims/jvmtiEnv.cpp
hotspot/src/share/vm/prims/jvmtiEnvBase.cpp
hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp
hotspot/src/share/vm/prims/unsafe.cpp
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/src/share/vm/runtime/safepoint.cpp
hotspot/src/share/vm/services/threadService.hpp
--- a/hotspot/agent/src/os/linux/symtab.c	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/agent/src/os/linux/symtab.c	Thu Oct 22 13:07:10 2015 -0400
@@ -545,6 +545,7 @@
      return (uintptr_t)NULL;
 
   item.key = (char*) strdup(sym_name);
+  item.data = NULL;
   hsearch_r(item, FIND, &ret, symtab->hash_table);
   if (ret) {
     struct elf_symbol * sym = (struct elf_symbol *)(ret->data);
--- a/hotspot/make/linux/makefiles/gcc.make	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/make/linux/makefiles/gcc.make	Thu Oct 22 13:07:10 2015 -0400
@@ -223,6 +223,8 @@
     WARNING_FLAGS += -Wtype-limits
     # GCC < 4.8 don't accept this flag for C++.
     WARNING_FLAGS += -Wno-format-zero-length
+    # GCC 4.8 reports less false positives than the older compilers.
+    WARNING_FLAGS += -Wuninitialized
   endif
 endif
 
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -1667,8 +1667,8 @@
   Register Rtmp1 = noreg;
 
   // check if it needs to be profiled
-  ciMethodData* md;
-  ciProfileData* data;
+  ciMethodData* md = NULL;
+  ciProfileData* data = NULL;
 
   if (op->should_profile()) {
     ciMethod* method = op->profiled_method();
@@ -1827,8 +1827,8 @@
     CodeStub* stub = op->stub();
 
     // check if it needs to be profiled
-    ciMethodData* md;
-    ciProfileData* data;
+    ciMethodData* md = NULL;
+    ciProfileData* data = NULL;
 
     if (op->should_profile()) {
       ciMethod* method = op->profiled_method();
@@ -2005,7 +2005,8 @@
     case lir_cond_greater:      acond = Assembler::greater;      ncond = Assembler::lessEqual;    break;
     case lir_cond_belowEqual:   acond = Assembler::belowEqual;   ncond = Assembler::above;        break;
     case lir_cond_aboveEqual:   acond = Assembler::aboveEqual;   ncond = Assembler::below;        break;
-    default:                    ShouldNotReachHere();
+    default:                    acond = Assembler::equal;        ncond = Assembler::notEqual;
+                                ShouldNotReachHere();
   }
 
   if (opr1->is_cpu_register()) {
@@ -3182,27 +3183,23 @@
   assert(default_type != NULL && default_type->is_array_klass() && default_type->is_loaded(), "must be true at this point");
 
   int elem_size = type2aelembytes(basic_type);
-  int shift_amount;
   Address::ScaleFactor scale;
 
   switch (elem_size) {
     case 1 :
-      shift_amount = 0;
       scale = Address::times_1;
       break;
     case 2 :
-      shift_amount = 1;
       scale = Address::times_2;
       break;
     case 4 :
-      shift_amount = 2;
       scale = Address::times_4;
       break;
     case 8 :
-      shift_amount = 3;
       scale = Address::times_8;
       break;
     default:
+      scale = Address::no_scale;
       ShouldNotReachHere();
   }
 
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -195,7 +195,7 @@
 
 
 LIR_Opr LIRGenerator::load_immediate(int x, BasicType type) {
-  LIR_Opr r;
+  LIR_Opr r = NULL;
   if (type == T_LONG) {
     r = LIR_OprFact::longConst(x);
   } else if (type == T_INT) {
@@ -484,7 +484,7 @@
     __ cmp(lir_cond_equal, right.result(), LIR_OprFact::longConst(0));
     __ branch(lir_cond_equal, T_LONG, new DivByZeroStub(info));
 
-    address entry;
+    address entry = NULL;
     switch (x->op()) {
     case Bytecodes::_lrem:
       entry = CAST_FROM_FN_PTR(address, SharedRuntime::lrem);
@@ -1054,7 +1054,7 @@
 
 void LIRGenerator::do_Convert(Convert* x) {
   // flags that vary for the different operations and different SSE-settings
-  bool fixed_input, fixed_result, round_result, needs_stub;
+  bool fixed_input = false, fixed_result = false, round_result = false, needs_stub = false;
 
   switch (x->op()) {
     case Bytecodes::_i2l: // fall through
--- a/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/cpu/x86/vm/jniFastGetField_x86_32.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -48,7 +48,7 @@
 // between loads, which is much more efficient than lfence.
 
 address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
-  const char *name;
+  const char *name = NULL;
   switch (type) {
     case T_BOOLEAN: name = "jni_fast_GetBooleanField"; break;
     case T_BYTE:    name = "jni_fast_GetByteField";    break;
@@ -122,7 +122,7 @@
 
   slowcase_entry_pclist[count++] = __ pc();
   __ bind (slow);
-  address slow_case_addr;
+  address slow_case_addr = NULL;
   switch (type) {
     case T_BOOLEAN: slow_case_addr = jni_GetBooleanField_addr(); break;
     case T_BYTE:    slow_case_addr = jni_GetByteField_addr();    break;
@@ -256,7 +256,7 @@
 }
 
 address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
-  const char *name;
+  const char *name = NULL;
   switch (type) {
     case T_FLOAT:  name = "jni_fast_GetFloatField";  break;
     case T_DOUBLE: name = "jni_fast_GetDoubleField"; break;
@@ -337,7 +337,7 @@
 
   slowcase_entry_pclist[count++] = __ pc();
   __ bind (slow);
-  address slow_case_addr;
+  address slow_case_addr = NULL;
   switch (type) {
     case T_FLOAT:  slow_case_addr = jni_GetFloatField_addr();  break;
     case T_DOUBLE: slow_case_addr = jni_GetDoubleField_addr(); break;
--- a/hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/cpu/x86/vm/jniFastGetField_x86_64.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -51,7 +51,7 @@
 // since that may scratch r10!
 
 address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
-  const char *name;
+  const char *name = NULL;
   switch (type) {
     case T_BOOLEAN: name = "jni_fast_GetBooleanField"; break;
     case T_BYTE:    name = "jni_fast_GetByteField";    break;
@@ -111,7 +111,7 @@
 
   slowcase_entry_pclist[count++] = __ pc();
   __ bind (slow);
-  address slow_case_addr;
+  address slow_case_addr = NULL;
   switch (type) {
     case T_BOOLEAN: slow_case_addr = jni_GetBooleanField_addr(); break;
     case T_BYTE:    slow_case_addr = jni_GetByteField_addr();    break;
@@ -153,7 +153,7 @@
 }
 
 address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
-  const char *name;
+  const char *name = NULL;
   switch (type) {
     case T_FLOAT:     name = "jni_fast_GetFloatField";     break;
     case T_DOUBLE:    name = "jni_fast_GetDoubleField";    break;
@@ -206,7 +206,7 @@
 
   slowcase_entry_pclist[count++] = __ pc();
   __ bind (slow);
-  address slow_case_addr;
+  address slow_case_addr = NULL;
   switch (type) {
     case T_FLOAT:     slow_case_addr = jni_GetFloatField_addr();  break;
     case T_DOUBLE:    slow_case_addr = jni_GetDoubleField_addr();
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -2794,7 +2794,7 @@
 
 
 int os::Linux::sched_getcpu_syscall(void) {
-  unsigned int cpu;
+  unsigned int cpu = 0;
   int retval = -1;
 
 #if defined(IA32)
@@ -4187,8 +4187,8 @@
       sigaddset(&(actp->sa_mask), sig);
     }
 
-    sa_handler_t hand;
-    sa_sigaction_t sa;
+    sa_handler_t hand = NULL;
+    sa_sigaction_t sa = NULL;
     bool siginfo_flag_set = (actp->sa_flags & SA_SIGINFO) != 0;
     // retrieve the chained handler
     if (siginfo_flag_set) {
@@ -4393,7 +4393,7 @@
 
 static const char* get_signal_handler_name(address handler,
                                            char* buf, int buflen) {
-  int offset;
+  int offset = 0;
   bool found = os::dll_address_to_library_name(handler, buf, buflen, &offset);
   if (found) {
     // skip directory names
--- a/hotspot/src/os_cpu/linux_x86/vm/copy_linux_x86.inline.hpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/os_cpu/linux_x86/vm/copy_linux_x86.inline.hpp	Thu Oct 22 13:07:10 2015 -0400
@@ -30,7 +30,7 @@
   (void)memmove(to, from, count * HeapWordSize);
 #else
   // Includes a zero-count check.
-  intx temp;
+  intx temp = 0;
   __asm__ volatile("        testl   %6,%6         ;"
                    "        jz      7f            ;"
                    "        cmpl    %4,%5         ;"
@@ -88,7 +88,7 @@
   }
 #else
   // Includes a zero-count check.
-  intx temp;
+  intx temp = 0;
   __asm__ volatile("        testl   %6,%6       ;"
                    "        jz      3f          ;"
                    "        cmpl    $32,%6      ;"
@@ -145,7 +145,7 @@
   (void)memmove(to, from, count);
 #else
   // Includes a zero-count check.
-  intx temp;
+  intx temp = 0;
   __asm__ volatile("        testl   %6,%6          ;"
                    "        jz      13f            ;"
                    "        cmpl    %4,%5          ;"
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -639,7 +639,7 @@
 
   if (l == r && !lt->is_float_kind()) {
     // pattern: If (a cond a) => simplify to Goto
-    BlockBegin* sux;
+    BlockBegin* sux = NULL;
     switch (x->cond()) {
     case If::eql: sux = x->sux_for(true);  break;
     case If::neq: sux = x->sux_for(false); break;
@@ -647,6 +647,7 @@
     case If::leq: sux = x->sux_for(true);  break;
     case If::gtr: sux = x->sux_for(false); break;
     case If::geq: sux = x->sux_for(true);  break;
+    default: ShouldNotReachHere();
     }
     // If is a safepoint then the debug information should come from the state_before of the If.
     set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux)));
@@ -684,7 +685,7 @@
       } else {
         // two successors differ and two successors are the same => simplify to: If (x cmp y)
         // determine new condition & successors
-        If::Condition cond;
+        If::Condition cond = If::eql;
         BlockBegin* tsux = NULL;
         BlockBegin* fsux = NULL;
              if (lss_sux == eql_sux) { cond = If::leq; tsux = lss_sux; fsux = gtr_sux; }
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -3823,8 +3823,8 @@
   caller_state->truncate_stack(args_base);
   assert(callee_state->stack_size() == 0, "callee stack must be empty");
 
-  Value lock;
-  BlockBegin* sync_handler;
+  Value lock = NULL;
+  BlockBegin* sync_handler = NULL;
 
   // Inline the locking of the receiver if the callee is synchronized
   if (callee->is_synchronized()) {
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -3348,7 +3348,7 @@
 }
 
 void LIRGenerator::increment_event_counter(CodeEmitInfo* info, int bci, bool backedge) {
-  int freq_log;
+  int freq_log = 0;
   int level = compilation()->env()->comp_level();
   if (level == CompLevel_limited_profile) {
     freq_log = (backedge ? Tier2BackedgeNotifyFreqLog : Tier2InvokeNotifyFreqLog);
@@ -3394,7 +3394,7 @@
   assert(level > CompLevel_simple, "Shouldn't be here");
 
   int offset = -1;
-  LIR_Opr counter_holder;
+  LIR_Opr counter_holder = NULL;
   if (level == CompLevel_limited_profile) {
     MethodCounters* counters_adr = method->ensure_method_counters();
     if (counters_adr == NULL) {
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp	Thu Oct 22 13:07:10 2015 -0400
@@ -409,7 +409,7 @@
   }
 
   static LIR_Condition lir_cond(If::Condition cond) {
-    LIR_Condition l;
+    LIR_Condition l = lir_cond_unknown;
     switch (cond) {
     case If::eql: l = lir_cond_equal;        break;
     case If::neq: l = lir_cond_notEqual;     break;
@@ -419,6 +419,7 @@
     case If::gtr: l = lir_cond_greater;      break;
     case If::aeq: l = lir_cond_aboveEqual;   break;
     case If::beq: l = lir_cond_belowEqual;   break;
+    default: fatal("You must pass valid If::Condition");
     };
     return l;
   }
--- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -414,6 +414,7 @@
     metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
   } else {
     fatal("Not implemented for other types of metadata");
+    return;
   }
 
   oop metadata_holder = metadata_owner_klass->klass_holder();
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -3211,19 +3211,19 @@
 
   // Field size and offset computation
   int nonstatic_field_size = _super_klass() == NULL ? 0 : _super_klass()->nonstatic_field_size();
-  int next_static_oop_offset;
-  int next_static_double_offset;
-  int next_static_word_offset;
-  int next_static_short_offset;
-  int next_static_byte_offset;
-  int next_nonstatic_oop_offset;
-  int next_nonstatic_double_offset;
-  int next_nonstatic_word_offset;
-  int next_nonstatic_short_offset;
-  int next_nonstatic_byte_offset;
-  int first_nonstatic_oop_offset;
-  int next_nonstatic_field_offset;
-  int next_nonstatic_padded_offset;
+  int next_static_oop_offset = 0;
+  int next_static_double_offset = 0;
+  int next_static_word_offset = 0;
+  int next_static_short_offset = 0;
+  int next_static_byte_offset = 0;
+  int next_nonstatic_oop_offset = 0;
+  int next_nonstatic_double_offset = 0;
+  int next_nonstatic_word_offset = 0;
+  int next_nonstatic_short_offset = 0;
+  int next_nonstatic_byte_offset = 0;
+  int first_nonstatic_oop_offset = 0;
+  int next_nonstatic_field_offset = 0;
+  int next_nonstatic_padded_offset = 0;
 
   // Count the contended fields by type.
   //
@@ -3376,14 +3376,14 @@
     ShouldNotReachHere();
   }
 
-  int nonstatic_oop_space_count   = 0;
-  int nonstatic_word_space_count  = 0;
-  int nonstatic_short_space_count = 0;
-  int nonstatic_byte_space_count  = 0;
-  int nonstatic_oop_space_offset;
-  int nonstatic_word_space_offset;
-  int nonstatic_short_space_offset;
-  int nonstatic_byte_space_offset;
+  int nonstatic_oop_space_count    = 0;
+  int nonstatic_word_space_count   = 0;
+  int nonstatic_short_space_count  = 0;
+  int nonstatic_byte_space_count   = 0;
+  int nonstatic_oop_space_offset   = 0;
+  int nonstatic_word_space_offset  = 0;
+  int nonstatic_short_space_offset = 0;
+  int nonstatic_byte_space_offset  = 0;
 
   // Try to squeeze some of the fields into the gaps due to
   // long/double alignment.
@@ -3455,7 +3455,7 @@
     // contended instance fields are handled below
     if (fs.is_contended() && !fs.access_flags().is_static()) continue;
 
-    int real_offset;
+    int real_offset = 0;
     FieldAllocationType atype = (FieldAllocationType) fs.allocation_type();
 
     // pack the rest of the fields
@@ -3589,7 +3589,7 @@
         // handle statics below
         if (fs.access_flags().is_static()) continue;
 
-        int real_offset;
+        int real_offset = 0;
         FieldAllocationType atype = (FieldAllocationType) fs.allocation_type();
 
         switch (atype) {
--- a/hotspot/src/share/vm/classfile/compactHashtable.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/classfile/compactHashtable.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -422,7 +422,7 @@
 
 int HashtableTextDump::scan_string_prefix() {
   // Expect /[0-9]+: /
-  int utf8_length;
+  int utf8_length = 0;
   get_num(':', &utf8_length);
   if (*_p != ' ') {
     corrupted(_p, "Wrong prefix format for string");
@@ -433,13 +433,13 @@
 
 int HashtableTextDump::scan_symbol_prefix() {
   // Expect /[0-9]+ (-|)[0-9]+: /
-  int utf8_length;
+  int utf8_length = 0;
   get_num(' ', &utf8_length);
-    if (*_p == '-') {
-     _p++;
+  if (*_p == '-') {
+    _p++;
   }
   int ref_num;
-  (void)get_num(':', &ref_num);
+  get_num(':', &ref_num);
   if (*_p != ' ') {
     corrupted(_p, "Wrong prefix format for symbol");
   }
--- a/hotspot/src/share/vm/classfile/placeholders.hpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/classfile/placeholders.hpp	Thu Oct 22 13:07:10 2015 -0400
@@ -220,7 +220,7 @@
   }
 
   SeenThread* actionToQueue(PlaceholderTable::classloadAction action) {
-    SeenThread* queuehead;
+    SeenThread* queuehead = NULL;
     switch (action) {
       case PlaceholderTable::LOAD_INSTANCE:
          queuehead = _loadInstanceThreadQ;
--- a/hotspot/src/share/vm/compiler/oopMap.hpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/compiler/oopMap.hpp	Thu Oct 22 13:07:10 2015 -0400
@@ -73,8 +73,8 @@
 
   // Constructors
   OopMapValue () { set_value(0); set_content_reg(VMRegImpl::Bad()); }
-  OopMapValue (VMReg reg, oop_types t) { set_reg_type(reg,t); }
-  OopMapValue (VMReg reg, oop_types t, VMReg reg2) { set_reg_type(reg,t); set_content_reg(reg2); }
+  OopMapValue (VMReg reg, oop_types t) { set_reg_type(reg, t); set_content_reg(VMRegImpl::Bad()); }
+  OopMapValue (VMReg reg, oop_types t, VMReg reg2) { set_reg_type(reg, t); set_content_reg(reg2); }
   OopMapValue (CompressedReadStream* stream) { read_from(stream); }
 
   // Archiving
@@ -87,7 +87,7 @@
 
   void read_from(CompressedReadStream* stream) {
     set_value(stream->read_int());
-    if(is_callee_saved() || is_derived_oop()) {
+    if (is_callee_saved() || is_derived_oop()) {
       set_content_reg(VMRegImpl::as_VMReg(stream->read_int(), true));
     }
   }
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -1795,7 +1795,7 @@
   }
 
   // Used for PrintGC
-  size_t prev_used;
+  size_t prev_used = 0;
   if (PrintGC && Verbose) {
     prev_used = _cmsGen->used();
   }
@@ -7739,7 +7739,7 @@
 
   HeapWord* const fc_addr = (HeapWord*) fc;
 
-  bool coalesce;
+  bool coalesce = false;
   const size_t left  = pointer_delta(fc_addr, freeFinger());
   const size_t right = chunkSize;
   switch (FLSCoalescePolicy) {
--- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -563,7 +563,7 @@
   assert(_n_fine_entries == _max_fine_entries, "Precondition");
   PerRegionTable* max = NULL;
   jint max_occ = 0;
-  PerRegionTable** max_prev;
+  PerRegionTable** max_prev = NULL;
   size_t max_ind;
 
   size_t i = _fine_eviction_start;
@@ -599,6 +599,7 @@
   }
 
   guarantee(max != NULL, "Since _n_fine_entries > 0");
+  guarantee(max_prev != NULL, "Since max != NULL.");
 
   // Set the corresponding coarse bit.
   size_t max_hrm_index = (size_t) max->hr()->hrm_index();
@@ -1138,7 +1139,7 @@
 
 void HeapRegionRemSet::print_recorded() {
   int cur_evnt = 0;
-  Event cur_evnt_kind;
+  Event cur_evnt_kind = Event_illegal;
   int cur_evnt_ind = 0;
   if (_n_recorded_events > 0) {
     cur_evnt_kind = _recorded_events[cur_evnt];
--- a/hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/gc/g1/heapRegionRemSet.hpp	Thu Oct 22 13:07:10 2015 -0400
@@ -222,7 +222,7 @@
 
 public:
   enum Event {
-    Event_EvacStart, Event_EvacEnd, Event_RSUpdateEnd
+    Event_EvacStart, Event_EvacEnd, Event_RSUpdateEnd, Event_illegal
   };
 
 private:
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -562,7 +562,7 @@
   if (StopInterpreterAt > 0)                                     stop_interpreter_at();
   __ verify_FPU(1, t->tos_in());
 #endif // !PRODUCT
-  int step;
+  int step = 0;
   if (!t->does_dispatch()) {
     step = t->is_wide() ? Bytecodes::wide_length_for(t->bytecode()) : Bytecodes::length_for(t->bytecode());
     if (tos_out == ilgl) tos_out = t->tos_out();
--- a/hotspot/src/share/vm/memory/allocation.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/memory/allocation.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -66,7 +66,7 @@
 }
 
 void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() {
-  address res;
+  address res = NULL;
   switch (type) {
    case C_HEAP:
     res = (address)AllocateHeap(size, flags, CALLER_PC);
@@ -88,8 +88,8 @@
 
 void* ResourceObj::operator new(size_t size, const std::nothrow_t&  nothrow_constant,
     allocation_type type, MEMFLAGS flags) throw() {
-  //should only call this with std::nothrow, use other operator new() otherwise
-  address res;
+  // should only call this with std::nothrow, use other operator new() otherwise
+  address res = NULL;
   switch (type) {
    case C_HEAP:
     res = (address)AllocateHeap(size, flags, CALLER_PC, AllocFailStrategy::RETURN_NULL);
--- a/hotspot/src/share/vm/opto/callGenerator.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -671,7 +671,7 @@
                                            &exact_receiver);
 
   SafePointNode* slow_map = NULL;
-  JVMState* slow_jvms;
+  JVMState* slow_jvms = NULL;
   { PreserveJVMState pjvms(&kit);
     kit.set_control(slow_ctl);
     if (!kit.stopped()) {
--- a/hotspot/src/share/vm/opto/compile.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/opto/compile.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -3757,7 +3757,7 @@
   MacroAssembler _masm(&cb);
   for (int i = 0; i < _constants.length(); i++) {
     Constant con = _constants.at(i);
-    address constant_addr;
+    address constant_addr = NULL;
     switch (con.type()) {
     case T_LONG:   constant_addr = _masm.long_constant(  con.get_jlong()  ); break;
     case T_FLOAT:  constant_addr = _masm.float_constant( con.get_jfloat() ); break;
--- a/hotspot/src/share/vm/opto/compile.hpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/opto/compile.hpp	Thu Oct 22 13:07:10 2015 -0400
@@ -89,7 +89,7 @@
 typedef unsigned int node_idx_t;
 class NodeCloneInfo {
  private:
-  uint64_t  _idx_clone_orig;
+  uint64_t _idx_clone_orig;
  public:
 
   void set_idx(node_idx_t idx) {
@@ -98,17 +98,17 @@
   node_idx_t idx() const { return (node_idx_t)(_idx_clone_orig & 0xFFFFFFFF); }
 
   void set_gen(int generation) {
-    uint64_t  g = (uint64_t)generation << 32;
+    uint64_t g = (uint64_t)generation << 32;
     _idx_clone_orig = _idx_clone_orig & 0xFFFFFFFF | g;
   }
   int gen() const { return (int)(_idx_clone_orig >> 32); }
 
-  void set(uint64_t x) {  _idx_clone_orig = x; }
-  void set(node_idx_t x, int g) {  set_idx(x); set_gen(g); }
+  void set(uint64_t x) { _idx_clone_orig = x; }
+  void set(node_idx_t x, int g) { set_idx(x); set_gen(g); }
   uint64_t get() const { return _idx_clone_orig; }
 
   NodeCloneInfo(uint64_t idx_clone_orig) : _idx_clone_orig(idx_clone_orig) {}
-  NodeCloneInfo(node_idx_t x, int g) {set(x, g);}
+  NodeCloneInfo(node_idx_t x, int g) : _idx_clone_orig(0) { set(x, g); }
 
   void dump() const;
 };
--- a/hotspot/src/share/vm/opto/generateOptoStub.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/opto/generateOptoStub.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -261,7 +261,7 @@
 
   //-----------------------------
   // If this is a normal subroutine return, issue the return and be done.
-  Node *ret;
+  Node *ret = NULL;
   switch( is_fancy_jump ) {
   case 0:                       // Make a return instruction
     // Return to caller, free any space for return address
--- a/hotspot/src/share/vm/opto/lcm.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/opto/lcm.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -806,7 +806,7 @@
   block->insert_node(proj, node_cnt++);
 
   // Select the right register save policy.
-  const char * save_policy;
+  const char *save_policy = NULL;
   switch (op) {
     case Op_CallRuntime:
     case Op_CallLeaf:
--- a/hotspot/src/share/vm/opto/library_call.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -1364,7 +1364,7 @@
 // public static double Math.log10(double)
 bool LibraryCallKit::inline_math(vmIntrinsics::ID id) {
   Node* arg = round_double_node(argument(0));
-  Node* n;
+  Node* n = NULL;
   switch (id) {
   case vmIntrinsics::_dabs:   n = new AbsDNode(                arg);  break;
   case vmIntrinsics::_dsqrt:  n = new SqrtDNode(C, control(),  arg);  break;
@@ -2108,7 +2108,7 @@
 // inline long       Long.reverseBytes(long)
 bool LibraryCallKit::inline_number_methods(vmIntrinsics::ID id) {
   Node* arg = argument(0);
-  Node* n;
+  Node* n = NULL;
   switch (id) {
   case vmIntrinsics::_numberOfLeadingZeros_i:   n = new CountLeadingZerosINode( arg);  break;
   case vmIntrinsics::_numberOfLeadingZeros_l:   n = new CountLeadingZerosLNode( arg);  break;
@@ -2648,7 +2648,7 @@
 
   // For now, we handle only those cases that actually exist: ints,
   // longs, and Object. Adding others should be straightforward.
-  Node* load_store;
+  Node* load_store = NULL;
   switch(type) {
   case T_INT:
     if (kind == LS_xadd) {
@@ -3654,7 +3654,7 @@
   Node* end               = is_copyOfRange? argument(2): argument(1);
   Node* array_type_mirror = is_copyOfRange? argument(3): argument(2);
 
-  Node* newcopy;
+  Node* newcopy = NULL;
 
   // Set the original stack and the reexecute bit for the interpreter to reexecute
   // the bytecode that invokes Arrays.copyOf if deoptimization happens.
@@ -4089,7 +4089,7 @@
 
 bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) {
   Node* arg = argument(0);
-  Node* result;
+  Node* result = NULL;
 
   switch (id) {
   case vmIntrinsics::_floatToRawIntBits:    result = new MoveF2INode(arg);  break;
@@ -5718,7 +5718,7 @@
 
 //------------------------------inline_aescrypt_Block-----------------------
 bool LibraryCallKit::inline_aescrypt_Block(vmIntrinsics::ID id) {
-  address stubAddr;
+  address stubAddr = NULL;
   const char *stubName;
   assert(UseAES, "need AES instruction support");
 
@@ -5784,8 +5784,8 @@
 
 //------------------------------inline_cipherBlockChaining_AESCrypt-----------------------
 bool LibraryCallKit::inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id) {
-  address stubAddr;
-  const char *stubName;
+  address stubAddr = NULL;
+  const char *stubName = NULL;
 
   assert(UseAES, "need AES instruction support");
 
--- a/hotspot/src/share/vm/opto/macro.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/opto/macro.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -779,10 +779,10 @@
   ciKlass* klass = NULL;
   ciInstanceKlass* iklass = NULL;
   int nfields = 0;
-  int array_base;
-  int element_size;
-  BasicType basic_elem_type;
-  ciType* elem_type;
+  int array_base = 0;
+  int element_size = 0;
+  BasicType basic_elem_type = T_ILLEGAL;
+  ciType* elem_type = NULL;
 
   Node* res = alloc->result_cast();
   assert(res == NULL || res->is_CheckCastPP(), "unexpected AllocateNode result");
@@ -1305,10 +1305,10 @@
   // We need a Region and corresponding Phi's to merge the slow-path and fast-path results.
   // they will not be used if "always_slow" is set
   enum { slow_result_path = 1, fast_result_path = 2 };
-  Node *result_region;
-  Node *result_phi_rawmem;
-  Node *result_phi_rawoop;
-  Node *result_phi_i_o;
+  Node *result_region = NULL;
+  Node *result_phi_rawmem = NULL;
+  Node *result_phi_rawoop = NULL;
+  Node *result_phi_i_o = NULL;
 
   // The initial slow comparison is a size check, the comparison
   // we want to do is a BoolTest::gt
--- a/hotspot/src/share/vm/opto/parse1.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -108,7 +108,7 @@
 
   // Very similar to LoadNode::make, except we handle un-aligned longs and
   // doubles on Sparc.  Intel can handle them just fine directly.
-  Node *l;
+  Node *l = NULL;
   switch (bt) {                // Signature is flattened
   case T_INT:     l = new LoadINode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInt::INT,        MemNode::unordered); break;
   case T_FLOAT:   l = new LoadFNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::FLOAT,         MemNode::unordered); break;
@@ -1903,7 +1903,7 @@
   // Now use a Phi here for merging
   assert(!nocreate, "Cannot build a phi for a block already parsed.");
   const JVMState* jvms = map->jvms();
-  const Type* t;
+  const Type* t = NULL;
   if (jvms->is_loc(idx)) {
     t = block()->local_type_at(idx - jvms->locoff());
   } else if (jvms->is_stk(idx)) {
--- a/hotspot/src/share/vm/opto/split_if.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/opto/split_if.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -451,8 +451,8 @@
 
   // Replace both uses of 'new_iff' with Regions merging True/False
   // paths.  This makes 'new_iff' go dead.
-  Node *old_false, *old_true;
-  Node *new_false, *new_true;
+  Node *old_false = NULL, *old_true = NULL;
+  Node *new_false = NULL, *new_true = NULL;
   for (DUIterator_Last j2min, j2 = iff->last_outs(j2min); j2 >= j2min; --j2) {
     Node *ifp = iff->last_out(j2);
     assert( ifp->Opcode() == Op_IfFalse || ifp->Opcode() == Op_IfTrue, "" );
--- a/hotspot/src/share/vm/opto/superword.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/opto/superword.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -3665,7 +3665,7 @@
 }
 
 int SuperWord::mark_generations() {
-  Node *ii_err = 0, *tail_err;
+  Node *ii_err = NULL, *tail_err = NULL;
   for (int i = 0; i < _mem_slice_head.length(); i++) {
     Node* phi  = _mem_slice_head.at(i);
     assert(phi->is_Phi(), "must be phi");
--- a/hotspot/src/share/vm/prims/jvmtiEnter.xsl	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiEnter.xsl	Thu Oct 22 13:07:10 2015 -0400
@@ -629,8 +629,8 @@
   jint trace_flags = JvmtiTrace::trace_flags(</xsl:text>
       <xsl:value-of select="@num"/>
       <xsl:text>);
-  const char *func_name;
-  const char *curr_thread_name;
+  const char *func_name = NULL;
+  const char *curr_thread_name = NULL;
   if (trace_flags) {
     func_name = JvmtiTrace::function_name(</xsl:text>
       <xsl:value-of select="@num"/>
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -3064,7 +3064,7 @@
     // in thread.cpp.
     JvmtiPendingMonitors::enter(rmonitor);
   } else {
-    int r;
+    int r = 0;
     Thread* thread = Thread::current();
 
     if (thread->is_Java_thread()) {
@@ -3127,7 +3127,7 @@
       err = JVMTI_ERROR_NOT_MONITOR_OWNER;
     }
   } else {
-    int r;
+    int r = 0;
     Thread* thread = Thread::current();
 
     if (thread->is_Java_thread()) {
@@ -3161,7 +3161,7 @@
 // rmonitor - pre-checked for validity
 jvmtiError
 JvmtiEnv::RawMonitorWait(JvmtiRawMonitor * rmonitor, jlong millis) {
-  int r;
+  int r = 0;
   Thread* thread = Thread::current();
 
   if (thread->is_Java_thread()) {
@@ -3220,7 +3220,7 @@
 // rmonitor - pre-checked for validity
 jvmtiError
 JvmtiEnv::RawMonitorNotify(JvmtiRawMonitor * rmonitor) {
-  int r;
+  int r = 0;
   Thread* thread = Thread::current();
 
   if (thread->is_Java_thread()) {
@@ -3251,7 +3251,7 @@
 // rmonitor - pre-checked for validity
 jvmtiError
 JvmtiEnv::RawMonitorNotifyAll(JvmtiRawMonitor * rmonitor) {
-  int r;
+  int r = 0;
   Thread* thread = Thread::current();
 
   if (thread->is_Java_thread()) {
--- a/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -512,7 +512,7 @@
 // mean much better out of memory handling
 unsigned char *
 JvmtiEnvBase::jvmtiMalloc(jlong size) {
-  unsigned char* mem;
+  unsigned char* mem = NULL;
   jvmtiError result = allocate(size, &mem);
   assert(result == JVMTI_ERROR_NONE, "Allocate failed");
   return mem;
@@ -1032,7 +1032,7 @@
     // implied else: entry_count == 0
   }
 
-  jint nWant, nWait;
+  jint nWant = 0, nWait = 0;
   if (mon != NULL) {
     // this object has a heavyweight monitor
     nWant = mon->contentions(); // # of threads contending for monitor
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -336,7 +336,7 @@
       int new_name_and_type_ref_i = find_or_append_indirect_entry(scratch_cp, name_and_type_ref_i,
                                                           merge_cp_p, merge_cp_length_p, THREAD);
 
-      const char *entry_name;
+      const char *entry_name = NULL;
       switch (scratch_cp->tag_at(scratch_i).value()) {
       case JVM_CONSTANT_Fieldref:
         entry_name = "Fieldref";
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -783,7 +783,7 @@
 
 UNSAFE_ENTRY(jint, Unsafe_ArrayBaseOffset(JNIEnv *env, jobject unsafe, jclass acls))
   UnsafeWrapper("Unsafe_ArrayBaseOffset");
-  int base, scale;
+  int base = 0, scale = 0;
   getBaseAndScale(base, scale, acls, CHECK_0);
   return field_offset_from_byte_offset(base);
 UNSAFE_END
@@ -791,7 +791,7 @@
 
 UNSAFE_ENTRY(jint, Unsafe_ArrayIndexScale(JNIEnv *env, jobject unsafe, jclass acls))
   UnsafeWrapper("Unsafe_ArrayIndexScale");
-  int base, scale;
+  int base = 0, scale = 0;
   getBaseAndScale(base, scale, acls, CHECK_0);
   // This VM packs both fields and array elements down to the byte.
   // But watch out:  If this changes, so that array references for
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -3858,6 +3858,7 @@
 
     JavaVMOption option;
     option.optionString = opt_hd;
+    option.extraInfo = NULL;
 
     options->append(option);                // Fill in option
 
--- a/hotspot/src/share/vm/runtime/safepoint.cpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp	Thu Oct 22 13:07:10 2015 -0400
@@ -122,7 +122,7 @@
 
   // Save the starting time, so that it can be compared to see if this has taken
   // too long to complete.
-  jlong safepoint_limit_time;
+  jlong safepoint_limit_time = 0;
   timeout_error_printed = false;
 
   // PrintSafepointStatisticsTimeout can be specified separately. When
@@ -901,7 +901,7 @@
 
 
 void ThreadSafepointState::print_on(outputStream *st) const {
-  const char *s;
+  const char *s = NULL;
 
   switch(_type) {
     case _running                : s = "_running";              break;
--- a/hotspot/src/share/vm/services/threadService.hpp	Mon Oct 19 15:03:58 2015 +0200
+++ b/hotspot/src/share/vm/services/threadService.hpp	Thu Oct 22 13:07:10 2015 -0400
@@ -425,12 +425,12 @@
   }
 
   JavaThreadStatusChanger(JavaThread* java_thread,
-                          java_lang_Thread::ThreadStatus state) {
+                          java_lang_Thread::ThreadStatus state) : _old_state(java_lang_Thread::NEW) {
     save_old_state(java_thread);
     set_thread_status(state);
   }
 
-  JavaThreadStatusChanger(JavaThread* java_thread) {
+  JavaThreadStatusChanger(JavaThread* java_thread) : _old_state(java_lang_Thread::NEW) {
     save_old_state(java_thread);
   }
 
@@ -527,7 +527,7 @@
   // Current thread is the notifying thread which holds the monitor.
   static bool wait_reenter_begin(JavaThread *java_thread, ObjectMonitor *obj_m) {
     assert((java_thread != NULL), "Java thread should not be null here");
-    bool active  = false;
+    bool active = false;
     if (is_alive(java_thread) && ServiceUtil::visible_oop((oop)obj_m->object())) {
       active = contended_enter_begin(java_thread);
     }
@@ -542,7 +542,7 @@
   }
 
   JavaThreadBlockedOnMonitorEnterState(JavaThread *java_thread, ObjectMonitor *obj_m) :
-    JavaThreadStatusChanger(java_thread) {
+    _stat(NULL), _active(false), JavaThreadStatusChanger(java_thread) {
     assert((java_thread != NULL), "Java thread should not be null here");
     // Change thread status and collect contended enter stats for monitor contended
     // enter done for external java world objects and it is contended. All other cases