X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6BA73850417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1597688046; bh=/NWIOmTfRn3VmF8HyA3/A7mpqXb1WF68cKGPfoC3Hy8=; h=Date:From:To:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=OHYCGGzF2Fhc3RPmt9fZzfNp2UFVftCjO7iBfMXnNzWPjFLdmuawm8LFA94XFrY8W Yk6EZoa9NLieYFRwcWKRQwfL8jwEF7RHvva4VdhvWPS3sKbnh8PcDW3PPOmR7TaUWv CJtEevWzJRxBmqHIvuy/e7T/DuELpxQFg4KTQ0AQ= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B56403860C3A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=corinna-cygwin AT cygwin DOT com Date: Mon, 17 Aug 2020 20:13:59 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: [Attn: gcc maintainers] Re: unhandled C++ exceptions not propagating Message-ID: <20200817181359.GI3272@calimero.vinschen.de> Mail-Followup-To: cygwin AT cygwin DOT com References: <20200816125306 DOT 60dc246baf63d7f9fba60611 AT nifty DOT ne DOT jp> <6c27d8d6-876a-6c09-bccd-a9123400cfdb AT cornell DOT edu> <20200816225221 DOT d7c41334927c9766d6e26415 AT nifty DOT ne DOT jp> <84a15cee-d772-4422-9cf0-1cec8d188cae AT cornell DOT edu> <70f23307-6aaf-db8a-103e-81303350ffec AT cornell DOT edu> <9525d8c2-74af-5c04-8a04-d84df4b1f2ef AT cornell DOT edu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9525d8c2-74af-5c04-8a04-d84df4b1f2ef@cornell.edu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z5qVi6JzjDQ3Rf/EewjqJJSTEn4 RksKm3spsSakqqqwDsv9kjfV053WBlOy9sccOmTN4FcOe8gd5Dt9zZ7HtiyLo5H/JDddFSAjV 2/hQhwWipQk7/mXg9aYw== X-Spam-Status: No, score=-98.2 required=5.0 tests=BAYES_00, BODY_8BITS, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 07HIEYUs023993 On Aug 17 13:36, Ken Brown via Cygwin wrote: > On 8/16/2020 6:38 PM, Ken Brown via Cygwin wrote: > > One further comment, and then I'll shut up > > I lied. ...which is ok. > > and leave it to people who know what they're talking about: In the > > 64-bit case, the function _Unwind_RaiseException in libgcc/unwind-seh.c > > gets called, and it calls the Win32 function RaiseException as follows: > > > >   RaiseException (STATUS_GCC_THROW, 0, 1, (ULONG_PTR *)&exc); > > > > Then the following comment appears: > > > >   /* The exception handler installed in crt0 will continue any GCC > >      exception that reaches there (and isn't marked non-continuable). > >      Returning allows the C++ runtime to call std::terminate.  */ > > > > Apparently this doesn't actually happen. > > I'm beginning to think this is a bug in the Cygwin build of gcc. The file > unwind-seh.c is compiled on 64-bit Cygwin because __SEH__ is defined. But > it makes assumptions, such as those in the comment quoted above, that are > not valid on Cygwin. > > In fact, if you look at the main exception handler on Cygwin > (exceptions.cc:626), it is clear that the exception code STATUS_GCC_THROW > does not lead to continuation. It falls under the default case: > > default: > /* If we don't recognize the exception, we have to assume that > we are doing structured exception handling, and we let > something else handle it. */ > return ExceptionContinueSearch; > > [STATUS_GCC_THROW is 0x20474343, which shows up in the gdb output above as > an unknown target exception.] > > So it seems to me that either Cygwin's exception handler has to learn to > handle the exception codes defined in unwind-seh.c, or else gcc should be > built with __SEH__ undefined. > > JonY, Achim, Corinna, am I missing something? This stuff isn't really my strong point. IIUC the above comment correctly, we might get away with adding another case to the exception handler switch: #define STATUS_GCC_THROW 0x20474343 case STATUS_GCC_THROW: return ExceptionContinueExecution; Did you try that, by any chance? Thanks, Corinna -- Corinna Vinschen Cygwin Maintainer -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple