https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67280
Bug ID: 67280 Summary: [5 Regression] wrong C++11 code generated on arm-linux-gnueabihf Product: gcc Version: 5.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: doko at gcc dot gnu.org Target Milestone: --- seen with the 5 branch svn r226731 on arm-linux-gnueabihf, works with -O1, fails with -O2. works on x86_64 and aarch64. $ cat foo.cc #include <iostream> #include <exception> #include <functional> namespace { void run(std::function<void()> const& f) { try { f(); } catch (std::exception const& e) { std::cerr << "ignored exception: " << e.what() << std::endl; } } } int main() { run([]{ throw std::runtime_error("some error"); }); run([]{ throw std::runtime_error("some error"); }); } $ g++ -O1 -std=c++11 foo.cc && ./a.out ignored exception: some error ignored exception: some error $ g++ -O2 -std=c++11 foo.cc && ./a.out terminate called after throwing an instance of 'std::runtime_error' what(): some error Aborted $ g++ -Os -std=c++11 foo.cc && ./a.out terminate called after throwing an instance of 'std::runtime_error' what(): some error Aborted $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/5/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.2.1-15ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-multilib --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf Thread model: posix gcc version 5.2.1 20150808 (Ubuntu 5.2.1-15ubuntu1)