Bug 2542 - dead assignment on wifi mac-low
dead assignment on wifi mac-low
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: wifi
unspecified
All All
: P5 enhancement
Assigned To: sebastien.deronne
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-11-06 06:04 UTC by natale.patriciello
Modified: 2016-11-07 17:12 UTC (History)
1 user (show)

See Also:


Attachments
patch (1.04 KB, patch)
2016-11-06 06:04 UTC, natale.patriciello
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description natale.patriciello 2016-11-06 06:04:45 UTC
Created attachment 2660 [details]
patch

Very simple case, but please check if the variable (that now is read inside the NS_LOG_DEBUG statement) should be used somewhere else. Without the log statement, the variable value is ignored.
Comment 1 sebastien.deronne 2016-11-06 06:11:00 UTC
Natale, this will provide the same output right? But I guess this is better as you propose.
Comment 2 sebastien.deronne 2016-11-06 06:11:46 UTC
But I am a bit confused by the title of this bug though ...
Comment 3 natale.patriciello 2016-11-06 06:30:43 UTC
In fact a dead assignment triggered the error on the static analyzer, but I have corrected it by using that value, rather than removing the useless assignment.

Just before the log statement, the variable currentSequenceNumber has been assigned the value peek'd from the header, but then in the log statement is peek'd again the value from the header.

currentSequenceNumber, later in the code, is overwritten with another value; this lead to the dead assignment error. The patch uses the variable in the log statement instead of peeking again the value.

Note that I'm not sure if the value currentSequenceNumber should be used somewhere else, or it was assigned just for logging purpose.
Comment 4 sebastien.deronne 2016-11-07 16:44:07 UTC
OK to push
Comment 5 sebastien.deronne 2016-11-07 17:12:19 UTC
changeset 12394:b41f53199fc5