catchorg / Catch2

A modern, C++-native, test framework for unit-tests, TDD and BDD - using C++14, C++17 and later (C++11 support is in v2.x branch, and C++03 on the Catch1.x branch)
https://discord.gg/4CWS9zD
Boost Software License 1.0
18.59k stars 3.05k forks source link

g++ (macports) exception are not caught #1353

Open VictorEijkhout opened 6 years ago

VictorEijkhout commented 6 years ago

This probably started happening when I upgraded my OS and whatnot.

I have code that throws a std::string (or something inheriting from it) and a REQUIRE_NOTHROW gives this:

libc++abi.dylib: terminating with uncaught exception of type std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unittest_indexstruct is a Catch v2.3.0 host application.
Run with -? for options

-------------------------------------------------------------------------------
indexed indexstruct
  basic construction
  construction and simplify
-------------------------------------------------------------------------------
unittest_indexstruct.cxx:281
...............................................................................

unittest_indexstruct.cxx:281: FAILED:
due to a fatal error condition:
  SIGABRT - Abort (abnormal termination) signal

===============================================================================
test cases:   2 |   1 passed | 1 failed
assertions: 161 | 160 passed | 1 failed

Here's my g++:


[imp:371] g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin17/7.3.0/lto-wrapper
Target: x86_64-apple-darwin17
Configured with: /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_gcc7/gcc7/work/gcc-7.3.0/configure --prefix=/opt/local --build=x86_64-apple-darwin17 --enable-languages=c,c++,objc,obj-c++,lto,fortran --libdir=/opt/local/lib/gcc7 --includedir=/opt/local/include/gcc7 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-7 --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-7 --with-gxx-include-dir=/opt/local/include/gcc7/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-isl=/opt/local --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-build-config=bootstrap-debug --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-tls --with-pkgversion='MacPorts gcc7 7.3.0_1'
Thread model: posix
gcc version 7.3.0 (MacPorts gcc7 7.3.0_1) ```

The same code is perfectly handled by the Intel compiler and gcc on another platform.
horenmar commented 6 years ago

For practical reasons (I don't have a mac, there is a high chance of this being a 3rd party bug) I cannot really help you, but the bug is definitely interesting.