delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:from:to:subject:date:message-id:references | |
:in-reply-to:content-type:content-id:content-transfer-encoding | |
:mime-version; q=dns; s=default; b=liyNIgYWt8orZw/JnCbRODjGItP0T | |
LYruNgdx+yOmbMx//RsRL/sqjKJ49i4TaIVcgQmdpWVr4+1jx6OFLJ8FRu/G8Ih8 | |
ocopx4b9gYhEm+2DqwGcPFK0vBkmfxhXVNqOFgBXXXZmV4StQyzSQd1zUUxuKCIT | |
4yz+PWHE662A+8= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:from:to:subject:date:message-id:references | |
:in-reply-to:content-type:content-id:content-transfer-encoding | |
:mime-version; s=default; bh=GMes/sOhEXYLiKuMerw8CX5zsA4=; b=OEX | |
aY7oNKm7j7ZFkVjSifvYPsdrUZpxkeJbFrICfUt7aZCzmfSThI2zX3j994tiTxRM | |
mY2pcgxbauwbA9g9BZXn4i4nuu8iAnfdYblPOf6Ox9Ioju8qxWWAfdIJ6ICKKKhv | |
sMqLGPVB9S+59tqYvhjLZ5anrDdlPY8l9+zbozak= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Authentication-Results: | sourceware.org; auth=none |
X-Spam-SWARE-Status: | No, score=-2.4 required=5.0 tests=BAYES_00,CYGWIN_OWNER_BODY,GIT_PATCH_2,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=hill, Hill, suspicion, 0329 |
X-HELO: | EUR03-DB5-obe.outbound.protection.outlook.com |
ARC-Seal: | i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CQBxXNUMKiyLMTdOtBvSNc9aRjUZh1cgow5IbNlmjvcCbXVKXwP6D81Uwj9OWF6qmC1NAIQrcJes7WM+vUAE54hO5/NwPY6cjcCBfzTDRuZiIpAuLxqGwqxWcQo7hZXxtQK7cFkDuDpT4om8CimFvjuLdaAD6wtzcZydBe3lP6HRLd0Ow0k1h7IfRTfvN3UNL4ubc3uDVrYrc/CLEG/lndij1SsubQzPNMtmjvbujD7k+8stBRYc9yh5bcyXtauwUwyO6Cs4cGNYNJ2ldhSfsNzbxcGbH/TNV4/GET8v7mfH4tVl8NVdYoIAbFyqgpVev53lwKIscgOdNDpJlT9oxg== |
ARC-Message-Signature: | i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UqwhRTqahofdhlwDDUH0DBze6Btn6pCnvLFX7zyoXZM=; b=RODSipdhRQEh7+24NLfRYFEAIQvBCrP370yspHMYIWLU0LInMN0cJarWaBLWhkRmnuTGRBcRvcmEeSDKnIoxg4E5SBl14oVTNydFpMnVNKHmeXAgIwrlp0N7b9gio8pD1wYi+GyMuFyaJt4EfNAoEJQ1NtOcAw1A7KMShN2JzZNQHzV7/uInmcBg0/LVOOjTF4tStOcEQVEgplScDiZthlAU/v5YgRIyFGlssAO0SCX1TOGeSVyCgq9fTDa1TQxfn14hsoSA9a05ErU2O+CWOzvBy8aBqM60bsg6JFFMnoe7WVFQ6mw5cjAASBHegl4mTAQnXnpVwn4JsNbLCUIidw== |
ARC-Authentication-Results: | i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=onespin.com; dmarc=pass action=none header.from=onespin.com; dkim=pass header.d=onespin.com; arc=none |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=onespin.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UqwhRTqahofdhlwDDUH0DBze6Btn6pCnvLFX7zyoXZM=; b=VXFdn5r857/lWcXKf19oxKZQCX89AHG52JLtL8T8wcaSlkX31KnEan6EtTyyZ6HmNAzzu0Ai+BZdGjltTmxAqBoUk2mNDPcugU5F8QcxxnL0HhrPNC2OMse0QzHWcQbdckQFWK23wT4Alk/9vihQEjx1b4Ypk5VBcUHJ26T7Fqo= |
From: | Dominik Strasser <dominik DOT strasser AT onespin DOT com> |
To: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> |
Subject: | Re: [BUG] try..catch does not work if compiled with clang 8.0 |
Date: | Wed, 18 Dec 2019 17:17:22 +0000 |
Message-ID: | <c430664b-be39-dec3-a1a1-279b478f7c5d@onespin.com> |
References: | <CGME20191217093504eucas1p14cced4e1f9fcec50e44e9223d1761858 AT eucas1p1 DOT samsung DOT com> <000701d5b4bd$42c086f0$c84194d0$@samsung.com> <af3cb99f-f1cc-3bcc-9644-310c259eb222 AT SystematicSw DOT ab DOT ca> <a9a62b50-688c-5747-266a-e7bb8157adbb AT gmail DOT com> <b46cefcb-144b-50f8-1f79-d2879b4e4c25 AT SystematicSw DOT ab DOT ca> <016d01d5b5b5$47d6b8a0$d78429e0$@samsung.com> |
In-Reply-To: | <016d01d5b5b5$47d6b8a0$d78429e0$@samsung.com> |
authentication-results: | spf=none (sender IP is ) smtp.mailfrom=dominik DOT strasser AT onespin DOT com; |
x-ms-oob-tlc-oobclassifiers: | OLM:5236; |
received-spf: | None (protection.outlook.com: onespin.com does not designate permitted sender hosts) |
x-ms-exchange-senderadcheck: | 1 |
x-ms-exchange-transport-forked: | True |
MIME-Version: | 1.0 |
X-MS-Exchange-CrossTenant-mailboxtype: | HOSTED |
X-MS-Exchange-CrossTenant-userprincipalname: | V43GUz04afslTPMirQaPpjwW3fY30Q2Xpxqplu7lZT5LTDsca1QL3GXCrZVNMgHNr5oOUxGuEfGYz+8rbDLy9GA7Mm4ihgrfeT0sfaYIKUA= |
X-MIME-Autoconverted: | from base64 to 8bit by delorie.com id xBIHI3NA014107 |
Hi, I am experiencing similar problems with my software. I am using Cygwin's mingw g++. The issue is very dependent on the files which are compiled, and how they are compiled. (-Ox, -g, ...) My suspicion is that the problem is with ld and the merging of the exception region tables, but was never able to track down the issue. However I cannot reproduce your issue on my machines. I tried: GNU C++14 (GCC) version 7.4.0 (x86_64-pc-cygwin) on a VM CYGWIN_NT-6.1 xxx 2.11.2(0.329/5/3) 2018-11-08 14:34 x86_64 Cygwin and GNU C++14 (GCC) Version 7.4.0 (x86_64-pc-cygwin) on my laptop CYGWIN_NT-10.0 xxx 3.1.1(0.340/5/3) 2019-12-18 09:28 x86_64 Cygwin with very different cygwin versions. Both of them give ./catch_test std::exception: Error in reading no_such_file.bin I tried my default compiler, too: GNU C++14 (GCC) version 7.4.0 (x86_64-w64-mingw32) No problems with this setup either. Can you maybe post your binary so I could try it with this one. Best regards Dominik Am 18.12.2019 um 16:10 schrieb Pavel Fedin: > Well, it turned out more complicated than i thought. Here is the reduced reproducer: > --- cut catch_test.cpp --- > #include <stdexcept> > #include <iostream> > #include <vector> > #include <string> > #include <fstream> > > void from_file(const std::string &filepath, std::vector<int8_t> &data); > > int main() > { > try > { > std::vector<int8_t> data; > > from_file("no_such_file.bin", data); > std::cout << "Success ???" << std::endl; > } > catch (const std::exception &e) > { > std::cout << "std::exception: " << e.what() << std::endl; > } > > return 0; > } > --- cut catch_test.cpp --- > --- cut catch_test_2.cpp --- > #include <stdexcept> > #include <iostream> > #include <vector> > #include <string> > #include <fstream> > > using namespace std; > > template <typename T> void from_file_impl(const string &filepath, vector<T> &data) > { > // data.clear(); > > std::ifstream ifs(filepath.c_str()); > if (ifs.rdstate() & ifstream::failbit) > { > throw std::runtime_error("Error in reading " + filepath); > } > > /* T buffer; > > while (ifs.read(reinterpret_cast<char *>(&buffer), sizeof(T))) > { > data.push_back(buffer); > }*/ > } > > void from_file(const string &filepath, vector<int8_t> &data) { from_file_impl(filepath, data); } > --- cut catch_test_2.cpp --- > --- cut console log --- > CORP+p DOT fedin AT P-FEDIN01 /cygdrive/d/Projects/Test > $ clang++-8 catch_test.cpp catch_test_2.cpp -g -o catch_test > > CORP+p DOT fedin AT P-FEDIN01 /cygdrive/d/Projects/Test > $ ./catch_test > > CORP+p DOT fedin AT P-FEDIN01 /cygdrive/d/Projects/Test > $ g++.exe catch_test.cpp catch_test_2.cpp -g -o catch_test > > CORP+p DOT fedin AT P-FEDIN01 /cygdrive/d/Projects/Test > $ ./catch_test > > CORP+p DOT fedin AT P-FEDIN01 /cygdrive/d/Projects/Test > $ clang++-5.0 catch_test.cpp catch_test_2.cpp -g -o catch_test > > CORP+p DOT fedin AT P-FEDIN01 /cygdrive/d/Projects/Test > $ ./catch_test > std::exception: Error in reading no_such_file.bin > > CORP+p DOT fedin AT P-FEDIN01 /cygdrive/d/Projects/Test > $ > --- cut console log --- > > So, the problem actually reproduces with both clang 8 and gcc (7.4.0 on my system). clang 5 works fine. > > You could also be interested in strace (here is end of the output only, the beginning is quite long and not very interesting): > --- cut --- > 22301 238862 [main] catch_test 6078 seterrno_from_nt_status: /home/corinna/src/cygwin/cygwin-3.1.0/cygwin-3.1.0-1.x86_64/src/newlib-cygwin/winsup/cygwin/fhandler.cc:724 status 0xC0000034 -> windows error 2 > 75 238937 [main] catch_test 6078 geterrno_from_win_error: windows error 2 == errno 2 > 42 238979 [main] catch_test 6078 fhandler_base::open: 0xC0000034 = NtCreateFile (0x10, 0x80100000, \??\D:\Projects\Test\no_such_file.bin, io, NULL, 0x0, 0x7, 0x1, 0x4020, NULL, 0) > 78 239057 [main] catch_test 6078 fhandler_base::open: 0 = fhandler_base::open(\??\D:\Projects\Test\no_such_file.bin, 0x108000) > 41 239098 [main] catch_test 6078 fhandler_base::open_fs: 0 = fhandler_disk_file::open(\??\D:\Projects\Test\no_such_file.bin, 0x8000) > 99 239197 [main] catch_test 6078 open: -1 = open(no_such_file.bin, 0x8000), errno 2 > --- Process 2620 (pid: 6078), exception 20474343 at 00007ff8c73fa388 > --- Process 2620 (pid: 6078) thread 12836 exited with status 0x20474343 > --- Process 2620 (pid: 6078) thread 3972 exited with status 0x20474343 > --- Process 2620 (pid: 6078) thread 15568 exited with status 0x20474343 > --- Process 2620 (pid: 6078) thread 5428 exited with status 0x20474343 > --- Process 2620 (pid: 6078) thread 2364 exited with status 0x20474343 > --- Process 2620 (pid: 6078) thread 16008 exited with status 0x20474343 > --- Process 2620 exited with status 0x20474343 > --- cut --- > 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) > > Kind regards, > Pavel Fedin > Senior Engineer > Samsung Electronics Research center Russia > > >> -----Original Message----- >> From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of Brian Inglis >> Sent: Wednesday, December 18, 2019 3:05 AM >> To: cygwin AT cygwin DOT com >> Subject: Re: [BUG] try..catch does not work if compiled with clang 8.0 >> >> On 2019-12-17 13:51, Csaba Ráduly wrote: >>> 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 >> Indeed! >>> 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 >>> $ ./a.exe >>> Caught a St13runtime_error - Ouch >> The report was about clang++ 8 vs 5; tweaked source to build under 5 and 8: >> ... >> #include <typeinfo> >> int pitcher() >> { >> throw std::runtime_error("Ouch"); >> } >> ... >> but same WJFFM results: >> $ clang++-5.0 -g -Og -Wpedantic -Wall -Wextra -o try-catch-stc{,.cpp} >> $ ./try-catch-stc >> Caught a St13runtime_error - Ouch >> $ clang++-8 -g -Og -Wpedantic -Wall -Wextra -o try-catch-stc{,.cpp} >> $ ./try-catch-stc >> Caught a St13runtime_error - Ouch >> -- >> Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada >> This email may be disturbing to some readers as it contains >> too much technical detail. Reader discretion is advised. >> -- >> Problem reports: https://protect2.fireeye.com/url?k=b437d571-e9e489fe-b4365e3e- >> 0cc47a31ce52-fd9c07d8a89a97f5&u=http://cygwin.com/problems.html >> FAQ: https://protect2.fireeye.com/url?k=2e1da12d-73cefda2-2e1c2a62- >> 0cc47a31ce52-67f7089b29388f59&u=http://cygwin.com/faq/ >> Documentation: https://protect2.fireeye.com/url?k=3f2aeb24-62f9b7ab-3f2b606b- >> 0cc47a31ce52-9528889b998d683e&u=http://cygwin.com/docs.html >> Unsubscribe info: https://protect2.fireeye.com/url?k=b1682add-ecbb7652-b169a192- >> 0cc47a31ce52-e02defedfa7edb6b&u=http://cygwin.com/ml/#unsubscribe-simple > > > > > > > -- > 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 > -- Dominik Strasser | Phone: +49 89 99013-436 OneSpin Solutions GmbH | Fax: +49 89 99013-100 Nymphenburgerstr. 20a 80335 Muenchen | dominik DOT strasser AT onespin DOT com Geschaeftsfuehrung: Dr. Raik Brinkmann, Oliver Habeck Vorsitzender des Beirats: Paul Hill Sitz: Muenchen; Amtsgericht Muenchen HRB 139464 UstID#: DE 814413215 -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |