Closed Bug 1476011 Opened 2 years ago Closed 2 years ago

[Static Analysis] DEAD_STORE error in js/src/jit/x86-shared/Disassember-x86-shared.cpp


(Core :: JavaScript Engine: JIT, defect, P3)




Tracking Status
firefox63 --- fixed


(Reporter: rbartlensky, Assigned: rbartlensky)




(1 file)

js/src/jit/x86-shared/Disassembler-x86-shared.cpp:165: error: DEAD_STORE
  The value written to &opcode (type unsigned int) is never used.
  163.   {
  164.       VexOperandType type = VEX_PS;
  165. >     uint32_t opcode = OP_HLT;
  166.       uint8_t modrm = 0;
  167.       uint8_t sib = 0;
Comment on attachment 8992389 [details]
Bug 1476011: Initialize opcode on different value.

So the DEAD_STORE warning is only used when initializing to a non-zero value, and initializing to 0 is always considered fine? r=me if you're sure this is how it works.
Attachment #8992389 - Flags: review?(jdemooij) → review+
Comment on attachment 8992389 [details]
Bug 1476011: Initialize opcode on different value.

DEAD_STORE warnings are concerned with not using the values that you assign to variables. Usually when you initialize a variable you either initialize it on 0 (which is fine from the POV of the analyzer), or on a non-zero value if you are going to use that value in some way later in the program.

For instance:

int x = getSomeNumber(); // fine because the value which is stored is also used
if (x == 5) {
  x = 2;

int x = getSomeNumber(); // DEAD_STORE -> you are storing a value in x, but never use it
                         // to fix the error you either drop the the return value of getSomeNumber, or
                         // use the return value before assigning another value to x
                         // basically DEAD_STORE = useless assingment, but it can also indicate that
                         // you forgot to use the value of x in between different assignments
x = getSomeOtherNumber();
Keywords: checkin-needed
Pushed by
Initialize opcode on different value. r=jandem
Keywords: checkin-needed
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.