Bug 2632 - Uninitialized variable error
Uninitialized variable error
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: lte
ns-3.26
PC Linux
: P3 normal
Assigned To: Biljana Bojović
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-01-24 06:07 UTC by Luciano Chaves
Modified: 2017-02-02 10:51 UTC (History)
1 user (show)

See Also:


Attachments
Patch for initializing the variables. (526 bytes, patch)
2017-01-24 06:07 UTC, Luciano Chaves
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Luciano Chaves 2017-01-24 06:07:45 UTC
Created attachment 2760 [details]
Patch for initializing the variables.

When compiling ns-3.26 in optimized mode using gcc (Debian 4.9.2-10) 4.9.2 on Debian 8 the following error appears:

[1141/1816] Compiling src/lte/helper/radio-environment-map-helper.cc
In file included from ./ns3/ptr.h:26:0,
                 from ./ns3/object.h:27,
                 from ../src/lte/helper/radio-environment-map-helper.h:26,
                 from ../src/lte/helper/radio-environment-map-helper.cc:22:
./ns3/assert.h: In member function ‘void ns3::RadioEnvironmentMapHelper::RunOneIteration(double, double, double, double)’:
./ns3/assert.h:70:22: error: ‘y’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
       if (!(condition))                                         \
                      ^
../src/lte/helper/radio-environment-map-helper.cc:286:10: note: ‘y’ was declared here
   double y;
          ^
cc1plus: all warnings being treated as errors

The attached patch fixes this bug, initializing the variable with value 0.0.
Comment 1 Biljana Bojović 2017-02-02 10:51:07 UTC
Thanks Luciano.

Pushed to changeset changeset 12610	01c054e8aa95: http://code.nsnam.org/ns-3-dev/rev/01c054e8aa95