RFR: 8263504: Some OutputMachOpcodes fields are uninitialized

Aleksey Shipilev shade at openjdk.java.net
Fri Mar 12 13:01:23 UTC 2021


SonarCloud reports:
  2 uninitialized fields at the end of the constructor calls

class OutputMachOpcodes : public OutputMap {
  int begin_inst_chain_rule;
  int end_inst_chain_rule;
  int begin_rematerialize; // <--- this
  int end_rematerialize;   // <--- and this
  int end_instructions;
public:
  OutputMachOpcodes(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
    : OutputMap(hpp, cpp, globals, AD, "MachOpcodes"),
      begin_inst_chain_rule(-1), end_inst_chain_rule(-1), end_instructions(-1)

They are written on all paths that I can see, but they should be initialized anyway, at least for proper checks in `closing()`.

-------------

Commit messages:
 - 8263504: Some OutputMachOpcodes fields are uninitialized

Changes: https://git.openjdk.java.net/jdk/pull/2967/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2967&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263504
  Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2967.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2967/head:pull/2967

PR: https://git.openjdk.java.net/jdk/pull/2967


More information about the hotspot-compiler-dev mailing list