Bug 1474034 - GCC 7 gives -Werror=maybe-uninitialized when compiling ns-3
Summary: GCC 7 gives -Werror=maybe-uninitialized when compiling ns-3
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-23 09:44 UTC by Vedran Miletić
Modified: 2017-09-19 15:51 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-09-19 15:51:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Vedran Miletić 2017-07-23 09:44:49 UTC
$ 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?

Comment 1 Vedran Miletić 2017-09-19 15:51:01 UTC
Fixed in gcc-c++-7.2.1-2.fc26.x86_64.


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