X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 001F63857C43 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1597696813; bh=R8W9w1AxCjEpwkPkSvgssK3mqi9rTe1R8SUqLegE9lI=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=uqN7E28QcDmcP2xDjMeQTteXIkkkaO062IJkV20s+qUBTqrOX0z727p2DJ7bJGGNQ 2tZ3+6rzXeoIj+RZGMrowlXRo+Iex5QPX0R7sQEDfebeGBhQTxuvtuICb1OBHKtMw6 6lR2WEJZq/tqJ87splS+hnwsEyrVw7HQVyl350iE= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9348F3858D37 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RTy0Cr77bqfY+Ui0o6GL3mRhb/Tx1mKe8xUOdeKkuzml3hJgSP4pPfZio09xpJOJJK3xS3PRnQj56UjxdZygQsJY++8XGMWjd3iG9O7DQnOp473a0qpn0B/i2w+Tg5guUi8pW0RMyfqqzKjKpT4E7aHQNY7r7oDEyILVJx/PQA8z2T/G4NKl6/yuuiLGyphZ7w/P1T4bdWR8Mu0hV4SKH7tYzTiRVUrDhPDDyHrActLR6CnFFG/WwahJOQTYosXjXcqqIlQu0nxL9vmsi1wnxFaZbaNqTV8qMdNwBtGAx1oX+Ba6i7RFlOKY9TpaDIEoWEGyFTwSrxEY2NG3WklQIg== 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=uT2UELbjv44dU60ZUZp/By09mO6sAbX1XNxbTty7JnI=; b=lt8gTXAtAAsdaW5kC/1QuZeQwxvmdPE5fhzKdoltcmuamknPpkO3mjmQlIFVUECDE/kTCkgoKDraNUSd+NYuowTz+8PmwymWCg71sEUEypImE6MLB/LrJbS2L3ZYxrQVGMS7ZiXrQRq6lhXqR89gDVQUIekj9UOq0s9Z5wHfgYx5dcMwhZlSZpeh+U/jggdvrz739PNL7l89mETrTbHFz4B1n9QKim2wELFQ3zKHQjdhVFatN2stsa66XOPJ4UzvLpLFE771U3iDZqLQ8RfeIBIG9D6LPQqIKoJ3HkU0nLunWqqnM4CozPMT7vwKlTheYTRmJtTGaIfo0JLF57KmTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none Subject: Re: [Attn: gcc maintainers] Re: unhandled C++ exceptions not propagating 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> <20200817181359 DOT GI3272 AT calimero DOT vinschen DOT de> <8338a995-1bab-9489-55c2-b6eb2e0ac844 AT cornell DOT edu> Message-ID: <437eecde-22ea-2777-3062-a0f43e7dbc70@cornell.edu> Date: Mon, 17 Aug 2020 16:40:07 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 In-Reply-To: <8338a995-1bab-9489-55c2-b6eb2e0ac844@cornell.edu> Content-Language: en-US X-ClientProxiedBy: MN2PR22CA0026.namprd22.prod.outlook.com (2603:10b6:208:238::31) To MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2604:6000:b407:7f00:6ddb:1b9b:deef:3580] (2604:6000:b407:7f00:6ddb:1b9b:deef:3580) by MN2PR22CA0026.namprd22.prod.outlook.com (2603:10b6:208:238::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.15 via Frontend Transport; Mon, 17 Aug 2020 20:40:08 +0000 X-Originating-IP: [2604:6000:b407:7f00:6ddb:1b9b:deef:3580] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 657ce4aa-1329-4acf-c4ee-08d842edbb54 X-MS-TrafficTypeDiagnostic: MN2PR04MB5901: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j8vhlbcSOUC3PruoJKR0x99DAN+zLa4K5Sdl3gmHmdEDPjl7UkyWIbzHAxgypf/I/RaWKz7nqHVxGvAxF38AXo1AegfSWJZBNVdER+JqoVUDvJoQujPEDTsGKjRtg4a1VO4mUnPj0rtJF8+fyB9n8+s3CJzo8/g1BHHbCBvOP8oXJnpABA9ClBVp4vLvxPTT5o7sRbyl17PP9KWztRyw4xcuSu8MZENpvzdI+BJhVerVzvy/b6GlFjbS8q8xoNJL0UbAiLl9nxBWzr9C8bzk7c8gyzZpS69/oRS1kianvH9hrfg4MbR5mncCbH94d9n2aWfHVmlic0UTn4mX1YzahN5lflnRv9S1028wU6BXjWwiNb6CP8NWGjx5hxk2ZjtQ X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR04MB6176.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(366004)(346002)(376002)(396003)(316002)(6486002)(75432002)(16526019)(786003)(2906002)(66946007)(66556008)(66476007)(186003)(6916009)(478600001)(8676002)(31686004)(36756003)(8936002)(52116002)(5660300002)(86362001)(2616005)(31696002)(53546011)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: o1+/Jdr30xzMKsryJhM18/4HMZ6uuiaMC2msNic9w30Gz8Vx7YUeMqsgovcqAWxDKF2m1G+OM7Es0cUsZZRLnIdBCsNoGi6xnRpXYHlm3/wbwpvWfNqHwFIJ8oqwQzaVyWDoKR8NRF3hqzvAsTNI6GOvdz8BTG3M7wMz26LMMgmgRuHhIEKTqSGhzH/3EAtLptYg5QioXewZ9QH8TrLJA87OQS4+H+9w6x+UDdohtKmT0duZCyBP7zSbiy8XyVD2X3pFthGu3BPS5Hl4Pd4y0KnvXEL+5gcLMFHF6t3yY+mylyQCSZNkpcGKZBP1vMvqJE11GM7Q9tYM8Hr+X3aLH5+v+T3UGLuYb4s+iim4ZFjsk7YR6MjWnvk5umZBUclMFASjYGriJ7iJivkubuK9S3QXuGbDDoeZIbFfKBQiU/rPTP5B12b8+zLtCeznyJEL+IJrDsTW9Wacdvt+wlbLS5CHQULw0WP4bbyFbDyMQObZnVfiQPoIglW5/mYYNVZunup5TEQYHotaUxnQqoXptMH9lUT+WCotoWVIIenwyVat5H4Iv4au8yLAPQguEmkNFdwxl1eEjE4Avr+qNSLiHfC2PSVkQfRFIcj0h+Bmbyc0eF+mchlFROV7ex/xrYq2OVcTsxHvYdRLECqWXsrKDr+yjQgrZDXXF0i5FRMZl1zZs2whMeEz+MM4YVix8DocVfdbZ/3Y7LZxKsSMGUvG2w== X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 657ce4aa-1329-4acf-c4ee-08d842edbb54 X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB6176.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2020 20:40:09.1891 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yzv/NWthO25dCdO4mwTsXVXEvkxPDgoUkK7uq0Gp7p29UpOI/+gPqV+wcyry3hGYDrhYoHUyKV8/t0IdWTOdxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5901 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no 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: , From: Ken Brown via Cygwin Reply-To: Ken Brown Content-Type: text/plain; charset="windows-1252"; Format="flowed" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 07HKebNL007350 On 8/17/2020 3:06 PM, Ken Brown via Cygwin wrote: > On 8/17/2020 2:13 PM, Corinna Vinschen wrote: >> 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? > > No, I didn't.  It might well solve the immediate problem of this bug report. But > then there are two other exception codes that occur in unwind-seh.c that we > would also have to deal with: STATUS_GCC_UNWIND    and STATUS_GCC_FORCED. > Someone would have to look at their uses and figure out what, if anything, > Cygwin should do with them. This isn't an issue after all. The comment I quoted above refers to all GCC exceptions, not just STATUS_GCC_THROW. I'll submit a patch after testing. Ken -- 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