Skip to content

Instantly share code, notes, and snippets.

@ewxrjk
Last active November 22, 2015 18:52
Show Gist options
  • Save ewxrjk/4a6b373691962ec2eb3d to your computer and use it in GitHub Desktop.
Save ewxrjk/4a6b373691962ec2eb3d to your computer and use it in GitHub Desktop.
G++ LTO bug?
$ type g++-5
g++-5 is /usr/bin/g++-5
$ g++-5 --version
g++-5 (Debian 5.2.1-23) 5.2.1 20151028
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ 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;
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment