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:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=NN4iQusM1JilDlus uS0Vh9iU9UYygfz+uj1m60T6N68nX8Sa1R3sqBonoB/k+KF8nzs4HW2GZdKaUWBa nqHYvsI0RKYFB5Dz7xAXVNg3UWaz1eyLNrN2QfiQT+FAH1ybpu54YO8nT5Q4/jFU iZXXVMhk8z4Vxfoo2/g7d1RHL9c= 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:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=IzvkC6O+E0AlKTiNYcCkqf aN+oU=; b=mqKRNbYDa09p8TTiwfJJaFC3t7HdpYRCTtzQ7NIaL9fZgKQUT/qDhQ zUfSZlITVOLn61CC0KbmIIGiT6AAm8CcRteOfRu+YbzXKe7cWt097LmRsHyMu5T3 gUfwJ3pJ0np6bW8x8gYY1QYvBJJo47D/UEz0jmLeD4fAUT2R6Fc08= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-3.1 required=5.0 tests=AWL,BAYES_00,KAM_NUMSUBJECT,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=H*M:50f8 X-HELO: smtp-out-no.shaw.ca Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca Subject: Re: [BUG] try..catch does not work if compiled with clang 8.0 To: cygwin AT cygwin DOT com References: <000701d5b4bd$42c086f0$c84194d0$@samsung.com> From: Brian Inglis Openpgp: preference=signencrypt Message-ID: Date: Tue, 17 Dec 2019 17:05:13 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Note-from-DJ: This may be spam 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 > #include > > 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 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: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple