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

RESOLVED FIXED in Firefox 63

Status

()

defect
P3
normal
RESOLVED FIXED
9 months ago
9 months ago

People

(Reporter: rbartlensky, Assigned: rbartlensky)

Tracking

unspecified
mozilla63
Points:
---

Firefox Tracking Flags

(firefox63 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

9 months ago
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 hidden (mozreview-request)

Comment 2

9 months ago
mozreview-review
Comment on attachment 8992389 [details]
Bug 1476011: Initialize opcode on different value.

https://reviewboard.mozilla.org/r/257254/#review264346

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+
(Assignee)

Comment 3

9 months ago
mozreview-review-reply
Comment on attachment 8992389 [details]
Bug 1476011: Initialize opcode on different value.

https://reviewboard.mozilla.org/r/257254/#review264346

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();
```
(Assignee)

Updated

9 months ago
Keywords: checkin-needed

Comment 4

9 months ago
Pushed by aiakab@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c67bdec5c592
Initialize opcode on different value. r=jandem
Keywords: checkin-needed

Comment 5

9 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/c67bdec5c592
Status: NEW → RESOLVED
Last Resolved: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
You need to log in before you can comment on or make changes to this bug.