Bug 2632

Summary: Uninitialized variable error
Product: ns-3 Reporter: Luciano Chaves <ljerezchaves>
Component: lteAssignee: Biljana Bojović <bbojovic>
Status: RESOLVED FIXED    
Severity: normal CC: ns-bugs
Priority: P3    
Version: ns-3.26   
Hardware: PC   
OS: Linux   
Attachments: Patch for initializing the variables.

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