Bug 1439647

Summary: GCC7 fails to compile C++ code: ‘<anonymous>’ is used uninitialized in this function
Product: [Fedora] Fedora Reporter: Luboš Uhliarik <luhliari>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: davejohansen, fweimer, jakub, jwakely, law, mpolacek
Target Milestone: ---   
Target Release: ---   
Hardware: armv7hl   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-7.1.1-3.fc26 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-25 16:20:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
HttpMsg.ii
none
HttpReply.ii
none
ProtocolVersion.h none

Description Luboš Uhliarik 2017-04-06 11:10:44 UTC
Description of problem:
With GCC update to version 7, I'm not able to build the newest squid only on arm arch. On all other archs, build succeeded. 

https://koji.fedoraproject.org/koji/taskinfo?taskID=18814683

Version-Release number of selected component (if applicable):
gcc-c++-7.0.1-0.13.fc27.armv7hl

How reproducible:
Try to build newest squid package in Fedora RAWHIDE

Steps to Reproduce:
1. fedpkg clone squid
2. fedpkg build --scratch
3. 

Actual results:
Squid build fails only on ARM

Expected results:
Squid build succeeded on all archs

Additional info:

Problem also occurred, when I reserved ARM machine and manually tried to compile HttpMsg.cc:

# make HttpMsg.o
armv7hl-redhat-linux-gnueabi-g++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\"/etc/squid/squid.conf\" -DDEFAULT_SQUID_DATA_DIR=\"/usr/share/squid\" -DDEFAULT_SQUID_CONFIG_DIR=\"/etc/squid\"   -I.. -I../include -I../lib -I../src -I../include    -I../src   -I/usr/include/libxml2  -I/usr/include/libxml2 -Wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual -Werror -pipe -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -march=armv7-a -mfpu=vfpv3-d16  -mfloat-abi=hard -fPIC -save-temps -c -o HttpMsg.o HttpMsg.cc
armv7hl-redhat-linux-gnueabi-g++: warning: -pipe ignored because -save-temps specified
In file included from http/one/Parser.h:12:0,
                 from HttpMsg.cc:13:
../src/anyp/ProtocolVersion.h: In constructor ‘HttpMsg::HttpMsg(http_hdr_owner_type)’:
../src/anyp/ProtocolVersion.h:34:83: error: ‘<anonymous>’ is used uninitialized in this function [-Werror=uninitialized]
     ProtocolVersion(ProtocolType which, unsigned int aMajor, unsigned int aMinor) : protocol(which) {
                                                                                   ^
../src/anyp/ProtocolVersion.h: In constructor ‘HttpMsg::HttpMsg(http_hdr_owner_type)’:
../src/anyp/ProtocolVersion.h:34:83: error: ‘<anonymous>’ is used uninitialized in this function [-Werror=uninitialized]
     ProtocolVersion(ProtocolType which, unsigned int aMajor, unsigned int aMinor) : protocol(which) {
                                                                                   ^
cc1plus: all warnings being treated as errors

I'm attaching HttpMsg.cc , HttpMsg.ii and /src/anyp/ProtocolVersion.h files.

Comment 1 Luboš Uhliarik 2017-04-06 11:12:38 UTC
Created attachment 1269339 [details]
HttpMsg.ii

Comment 2 Jakub Jelinek 2017-04-06 11:13:10 UTC
Don't use -Werror if you are not prepared to deal with warnings?
Some warnings have even false positives, if you use -Werror, you need to be prepared to work around those too.

Comment 3 Luboš Uhliarik 2017-04-06 11:13:20 UTC
Created attachment 1269341 [details]
HttpReply.ii

Comment 4 Luboš Uhliarik 2017-04-06 11:14:01 UTC
Created attachment 1269343 [details]
ProtocolVersion.h

Comment 5 Luboš Uhliarik 2017-04-06 11:59:32 UTC
This option is in this project enabled by default and it is NOT recommended to remove this option by upstream. It was working with this options for many years, and with update to GCC7 it stopped.

If it is error raised on all arches, It would be weird and I could try to find a workaround, but in this case, this "false-positive" warning is thrown only on arm arch.

I'm not sure, if it is correct approach, to disable -Werror only because there is just one weird error on arm arch. Even I tried to look at that warning, but I was not able to find anything, what could cause this warning.

If I disable -Werror even for ARM arch, I can overlook some true warnings on this arch.

Comment 6 Marek Polacek 2017-04-06 15:09:37 UTC
I opened PR80344 which has the reduced testcase.

Comment 7 Jakub Jelinek 2017-05-23 13:33:10 UTC
Should be fixed already in gcc-7.1.1-1.fc{26,27}.

Comment 8 Fedora Update System 2017-06-23 07:01:23 UTC
gcc-7.1.1-3.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-553e01aac0

Comment 9 Fedora Update System 2017-06-25 01:19:11 UTC
gcc-7.1.1-3.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-553e01aac0

Comment 10 Fedora Update System 2017-06-25 16:20:39 UTC
gcc-7.1.1-3.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.