https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86215
Bug ID: 86215 Summary: Exceptions are broken on OSX when linking with -static-libgcc Product: gcc Version: 7.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcc Assignee: unassigned at gcc dot gnu.org Reporter: ryan.burn at gmail dot com Target Milestone: --- If I compile program below with g++-7 main.cpp -static-libgcc -static-libstdc++ and run it on OSX, I get $ ./a.out Abort trap: 6 $ echo $? 134 instead of printing abc123 as expected /////////// main.cpp #include <exception> #include <iostream> int main() try { throw std::runtime_error{"abc123"}; return 0; } catch (const std::runtime_error& e) { std::cout << e.what() << "\n"; return 0; } ////////////////////// Additional information about the environment $ uname -a Darwin Ryans-MacBook-Pro.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64 $ g++-7 --version g++-7 (Homebrew GCC 7.3.0_1) 7.3.0 Copyright (C) 2017 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. See also https://stackoverflow.com/q/50920999/4447365