[Bug 1521081] Re: wrong "maybe-uninitialized" warning with -O3 (when building goplay)
Matthias Klose
doko at ubuntu.com
Wed Mar 16 09:59:25 UTC 2016
I doubt this is ppc specific, but triggered by -O3 instead.
** Summary changed:
- wrong "maybe-uninitialized" warning on ppc64el only (when building goplay)
+ wrong "maybe-uninitialized" warning with -O3 (when building goplay)
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-5 in Ubuntu.
https://bugs.launchpad.net/bugs/1521081
Title:
wrong "maybe-uninitialized" warning with -O3 (when building goplay)
Status in gcc-5 package in Ubuntu:
New
Bug description:
goplay FTBFS on ppc64el with:
g++ -DHAVE_CONFIG_H -I. -I.. -I.. -I/usr/include/tagcoll-2.0.14 -Wall -Werror -ggdb -g -O3 -fstack-protector-strong -Wformat -Werror=format-security -std=c++11 -c -o XDGDesktopEntry.o XDGDesktopEntry.cpp
XDGDesktopEntry.cpp: In member function 'int XDGDesktopEntry::run(const char*)':
XDGDesktopEntry.cpp:655:17: error: 'value' may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (value[i] == 'i') {
^
cc1plus: all warnings being treated as errors
full build log: https://launchpadlibrarian.net/227946515/buildlog_ubuntu-xenial-ppc64el.goplay_0.9.1%2Bnmu1_BUILDING.txt.gz
This does not make much sense to me. The code:
// Now run the desktop file
getEntry("Exec", NULL, &value);
// XXX: For now, just remove the field codes...
std::string commandString;
for(unsigned int i = 0; value[i] != '\0'; i++) {
if (value[i] == '%') {
i++;
if (value[i] == 'i') {
value is a "const char*" and gets initialized in the getEntry(). Even
*if* there was a reason to argue that value might be uninitialized,
then the complaint should already be for the "for" loop. There is no
reason why value should be valid in the "for" loop and for the
"value[i] == '%'" check, but after incrementing just "i" it would
suddenly not be any more.
It builds fine on Debian ppc64el
(https://buildd.debian.org/status/fetch.php?pkg=goplay&arch=ppc64el&ver=0.9.1%2Bnmu1&stamp=1448818386)
and on all other Ubuntu architectures. So this seems to be specific to
gcc-5 on Ubuntu on ppc64el.
ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: gcc-5 5.2.1-26ubuntu1
ProcVersionSignature: Ubuntu 4.2.0-19.23-generic 4.2.6
Uname: Linux 4.2.0-19-generic x86_64
ApportVersion: 2.19.2-0ubuntu8
Architecture: amd64
CurrentDesktop: Unity
Date: Mon Nov 30 08:19:47 2015
EcryptfsInUse: Yes
SourcePackage: gcc-5
UpgradeStatus: No upgrade log present (probably fresh install)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1521081/+subscriptions
More information about the foundations-bugs
mailing list