Bug 240 - NormalVariableImpl Copy Constructor
NormalVariableImpl Copy Constructor
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: core
pre-release
All All
: P1 major
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-06-26 11:17 UTC by Joe Kopena
Modified: 2008-07-01 13:32 UTC (History)
1 user (show)

See Also:


Attachments
Trivial fix for NormalVariableImpl copy constructor (505 bytes, patch)
2008-06-26 11:18 UTC, Joe Kopena
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Kopena 2008-06-26 11:17:06 UTC
There is a serious but trivial bug in the copy constructor for NormalVariableImpl.  It does not initialize m_nextValid, causing junk m_next results to be returned.  Beyond being an incorrect distribution then, the results may not obey the bounds.  This came up for me in that NormalVariable was still occasionally creating negative values, causing the scheduler to bail.

Note that m_nextValid should be initialized to false, rather than copying the value, as m_next is not copied (which sounds reasonable to me).

The fix for this is trivial, patch attached.

Thx
Comment 1 Joe Kopena 2008-06-26 11:18:36 UTC
Created attachment 188 [details]
Trivial fix for NormalVariableImpl copy constructor
Comment 2 Rajib Bhattacharjea 2008-06-26 14:18:26 UTC
+1 yes, this is correct.  Good work Joe...let merge this in ASAP.