Bug#805820: -Wuninitialized provokes unexpected error with LTO
Package: g++-5
Version: 5.2.1-23
$ type g++-5
g++-5 is /usr/bin/g++-5
$ dpkg -l g++-5 libstdc++-5-dev
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii g++-5 5.2.1-23 i386 GNU C++ compiler
ii libstdc++-5-de 5.2.1-23 i386 GNU Standard C++ Library v3
(deve
$ uname -a
Linux deodand 4.2.0-1-686-pae #1 SMP Debian 4.2.3-2 (2015-10-14) i686
GNU/Linux
$ cat t.cc
#include <regex>
#include <string>
int main() {
std::string a;
std::regex r("x");
return std::regex_match(a, r);
}
$ g++-5 -O2 -std=c++11 -Wuninitialized -c t.cc
$ g++-5 -O2 -std=c++11 -Wuninitialized -o t t.o
$ g++-5 -O2 -flto -fuse-linker-plugin -std=c++11 -Wuninitialized -c t.cc
$ g++-5 -O2 -flto -fuse-linker-plugin -std=c++11 -Wuninitialized -o t t.o
/usr/include/c++/5/bits/regex_compiler.tcc: In member function
‘_M_alternative’:
/usr/include/c++/5/bits/regex_compiler.tcc:266:8: warning: ‘__n’ may be
used uninitialized in this function [-Wmaybe-uninitialized]
for (long __i = 0; __i < __n; ++__i)
^
/usr/include/c++/5/bits/regex_compiler.tcc:230:9: note: ‘__n’ was
declared here
long __n;
^
The relevant bit of regex_compiler.tcc looks OK to me so I think this is
the compiler rather than the std::regex implementation. ICBW.
ttfn/rjk
Reply to: