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

Pavel Fedin p.fedin@samsung.com
Thu Dec 19 10:30:00 GMT 2019


 Hello!

> Confirmed with clang++ 8

 Good!
 Meanwhile i've tried to investigate it myself a bit and here's some more info:
 1. With clang 8 __cxa_throw() ends up in Windows RaiseException(); with clang 5 it simply doesn't make it there. I guess there's some problem with interpreting unwind info.
 2. strace actually reports "exception XXX at YYY" twice with clang 5, when the code is working. clang 8 code reports this only once before dying.
 3. The problem is triggered by a combination of template (from_file_impl) and "if" condition inside. If you remove any of these features (e. g. throw unconditionally or move the code from template into from_file()), the code starts working. Perhaps even generic clang 8 bug.

> but WJFFM with g++ 7.4.0 and reports exception (below).

 Yes, confirmed. I was tricked by the fact that clang does not append ".exe" to the binary name automatically (isn't it a small bug too?). So that shell sequence:

$ clang++-8 catch_test.cpp catch_test_2.cpp -g -o catch_test
$ g++ catch_test.cpp catch_test_2.cpp -g -o catch_test
 (note that no .exe suffix is given to -o !!!)

 ...produces two files, one named "catch_test" and another named "catch_test.exe". Attempt to execute "./catch_test" in the shell first tries to find the exact name and succeeds, always running the broken binary made by clang.

> >  So, a Windows exception is reported, then the whole thing silently quits.
> > I have an impression that it has to do with the bug I previously reported
> > (and someone here claimed he could reproduce it)
> 
> Please provide a link to the Cygwin ML message; is it this, confirmed by Takashi
> Yano:
> 
> 	https://cygwin.com/ml/cygwin/2019-10/msg00038.html

 Yes, that one.

Kind regards,
Pavel Fedin
Senior Engineer
Samsung Electronics Research center Russia


--
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



More information about the Cygwin mailing list