Bug 1474034 - GCC 7 gives -Werror=maybe-uninitialized when compiling ns-3
GCC 7 gives -Werror=maybe-uninitialized when compiling ns-3
Status: NEW
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
26
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-23 05:44 EDT by Vedran Miletić
Modified: 2017-07-23 05:45 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Vedran Miletić 2017-07-23 05:44:49 EDT
$ hg clone http://code.nsnam.org/ns-3-dev
$ cd ns-3-dev

Now, compiling in debug mode works fine:

$ ./waf configure
$ ./waf build

But compiling in optimized mode fails:

$ ./waf configure -d optimized
$ ./waf build
Waf: Entering directory `/home/vedranm/workspace/ns-3-allinone/ns-3-dev/build'
[1608/1955] Compiling src/lte/model/epc-mme.cc
In file included from ../src/lte/model/epc-mme.cc:25:0:
../src/lte/model/epc-s11-sap.h: In member function „void ns3::EpcMme::DoInitialUeMessage(uint64_t, uint16_t, uint64_t, uint16_t)”:
../src/lte/model/epc-s11-sap.h:183:10: greška: „msg.ns3::EpcS11SapSgw::CreateSessionRequestMessage::<anonymous>” may be used uninitialized in this function [-Werror=maybe-uninitialized]
   struct CreateSessionRequestMessage : public GtpcMessage
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Waf: Leaving directory `/home/vedranm/workspace/ns-3-allinone/ns-3-dev/build'
Build failed
 -> task in 'ns3-lte' failed (exit status 1): 
	{task 139949836372048: cxx epc-mme.cc -> epc-mme.cc.1.o}
['/usr/lib64/ccache/g++', '-O3', '-g', '-Wall', '-Werror', '-march=native', '-fstrict-overflow', '-Wstrict-overflow=2', '-std=c++11', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-pthread', '-I.', '-I..', '-I/usr/include/libxml2', '-DNS3_BUILD_PROFILE_OPTIMIZED', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_DL=1', '-DDL=1', '-DXML2=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_GSL=1', '-DHAVE_SQLITE3=1', '-DHAVE_LIBXML2=1', '../src/lte/model/epc-mme.cc', '-c', '-o', '/home/vedranm/workspace/ns-3-allinone/ns-3-dev/build/src/lte/model/epc-mme.cc.1.o']

GCC 6 compiles both fine. Furthermore if in epc-mme.cc one replaces

EpcS11SapSgw::CreateSessionRequestMessage msg;

with

EpcS11SapSgw::CreateSessionRequestMessage msg {};

the code compiles fine. All my attempts at getting a minimal example that exhibits the same behaviour have unfortunately failed.

Should I provide the preprocessed source file?

Note You need to log in before you can comment on or make changes to this bug.