This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [BUG] try..catch does not work if compiled with clang 8.0


On 17/12/2019 17:29, Brian Inglis wrote:
On 2019-12-17 02:35, Pavel Fedin wrote:
I haven't upgraded for a while and today i finally decided to do so. After
rebuilding by project with clang++ 8.0 i found out that try...catch construct
doesn't work. The program just gets silently aborted.
Switched back to old clang++ 5.0 and it works.
Also an old bug which i reported some (a while) time ago persists: uncaught
throw does not print anything.
OS is Windows 10 x86/64.
It is unlikely that try/catch does not work in the general case for clang++8,
and your post has insufficient information to reproduce the problem.

a.k.a. https://www.chiark.greenend.org.uk/~sgtatham/bugs.html#respect

WJFFM

$ cat catcher.cpp
#include <stdexcept>
#include <iostream>

int pitcher()
{
	throw std::runtime_error{"Ouch"};
}

int main()
{
	try {
		return pitcher();
	}
	catch (std::exception const&e) {
		std::cout << "Caught a " << typeid(e).name() << " - " << e.what() << '\n';
		return 42;
	}
}

$ g++ -v -Wall -Wpedantic -Wextra -g  catcher.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-8.3.0-1.x86_64/src/gcc-8.3.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-8.3.0-1.x86_64/src/gcc-8.3.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
Thread model: posix
gcc version 8.3.0 (GCC)
COLLECT_GCC_OPTIONS='-v' '-Wall' '-Wpedantic' '-Wextra' '-g' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/cc1plus.exe -quiet -v -idirafter /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../lib/../include/w32api -idirafter /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../x86_64-pc-cygwin/lib/../lib/../../include/w32api catcher.cpp -quiet -dumpbase catcher.cpp -mtune=generic -march=x86-64 -auxbase catcher -g -Wall -Wpedantic -Wextra -version -o /tmp/cczG1NcE.s
GNU C++14 (GCC) version 8.3.0 (x86_64-pc-cygwin)
compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../x86_64-pc-cygwin/include" ignoring duplicate directory "/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../x86_64-pc-cygwin/lib/../lib/../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/include/c++
 /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/include/c++/x86_64-pc-cygwin
 /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/include/c++/backward
 /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/include
 /usr/local/include
 /usr/include
 /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../lib/../include/w32api
End of search list.
GNU C++14 (GCC) version 8.3.0 (x86_64-pc-cygwin)
compiled by GNU C version 8.3.0, GMP version 6.1.2, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: bed998889edfd32f5c9a3f3c8baa420d
COLLECT_GCC_OPTIONS='-v' '-Wall' '-Wpedantic' '-Wextra' '-g' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../x86_64-pc-cygwin/bin/as.exe -v -o /tmp/ccCNGYho.o /tmp/cczG1NcE.s GNU assembler version 2.29.1 (x86_64-pc-cygwin) using BFD version (GNU Binutils) 2.29.1.20171006
COMPILER_PATH=/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/:/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/:/usr/lib/gcc/x86_64-pc-cygwin/:/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/:/usr/lib/gcc/x86_64-pc-cygwin/:/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../x86_64-pc-cygwin/bin/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/:/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../x86_64-pc-cygwin/lib/../lib/:/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../x86_64-pc-cygwin/lib/:/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-Wall' '-Wpedantic' '-Wextra' '-g' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/collect2.exe -plugin /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/cyglto_plugin.dll -plugin-opt=/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/lto-wrapper.exe -plugin-opt=-fresolution=/tmp/ccSrxYRN.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lcygwin -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id -m i386pep --wrap _Znwm --wrap _Znam --wrap _ZdlPv --wrap _ZdaPv --wrap _ZnwmRKSt9nothrow_t --wrap _ZnamRKSt9nothrow_t --wrap _ZdlPvRKSt9nothrow_t --wrap _ZdaPvRKSt9nothrow_t -Bdynamic --dll-search-prefix=cyg --tsaware /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../lib/crt0.o /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/crtbegin.o -L/usr/lib/gcc/x86_64-pc-cygwin/8.3.0 -L/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../x86_64-pc-cygwin/lib/../lib -L/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../x86_64-pc-cygwin/lib -L/usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../.. /tmp/ccCNGYho.o -lstdc++ -lgcc_s -lgcc -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32 -lgcc_s -lgcc /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/../../../../lib/default-manifest.o /usr/lib/gcc/x86_64-pc-cygwin/8.3.0/crtend.o COLLECT_GCC_OPTIONS='-v' '-Wall' '-Wpedantic' '-Wextra' '-g' '-shared-libgcc' '-mtune=generic' '-march=x86-64'

$ ./a.exe
Caught a St13runtime_error - Ouch

Csaba
--
You can get very substantial performance improvements
by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
So if you're looking for a completely portable, 100% standards-conformat way
to get the wrong information: this is what you want. - Scott Meyers (C++TDaWYK)

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]