delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2020/08/17/15:07:51

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4DF9B3861834
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1597691229;
bh=B1vv8Varf8fBuld4LvxbccN+fsTntEOGPUmuAt+d3I4=;
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=L11NC6wVsOG8MgDASOk8HRVoqRwtoJA6RQxYW2gpgpLsLghOwKyr+OpwOnDWLiSyr
TnMb1XDNGMWYyqe1iUkg/nQXuoYfIgmJkVyXAA5cu8qFZa20aMWKd2TpzYax008atT
jNPICTOoly7vLh1lCrOPR9guxRbn/MSPKel7Zi4Q=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 393C7386103E
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=R2kcwSWdXdcpInjbPIcRl41MdP7ZD7cEINQz/pint86LazvYQ+Vo999a9e0/vdaT/HgiovNrv4xNgmUfoWSCbLR9avLynJBlqb72u5bak60Dz8N99ofmVz4aMg4qERTQ7aaxq7O/PsOxLl/yaQmqCw+gTD2NP9RobLlPVXLS+Af4cZvxP8MF3Fy2fHilA41l4+2NOYhKUk6ZVHPf02wZ5SwIXiBekYmuMBwWqPKEBdqyHKyLg+bebmGhzNs5Ttz+3p3JL6+21r45ALd6AK41GDbQzMK4Tx6SYcwHSNNSwhIYZfkB0zv53zIhdTaMPYzR/aObYe079s/ThGlldqF81Q==
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=UBrPg37N8LD43wNqJ4ATppclCR3znONoA8SRHhrZoV0=;
b=H0EDwIaRfMZoHFX/nxn2aEcZl07NkB5Vb5lbLeHeR28yqMaw/K96zE1+9Pzt+KS7r8jTlyD4mZHEz37QBEQJ7SVTZEkX08SAOoXu1NERH/guXx+ORWsGkxm81xg5hZ6DDul298/B66DP3OUlJn7sZ+QsrGOitS4sp/6Yk1Fx9v6Sg0k5i/6lWfnRRuX0P4m0QZD2+R9w7jyJqC4KziFpn+djZEZr8nx5dllro9KavRJWjqqYRJgPpTeBPGRLB2lAcmdXPzejKU7j3EYnyt6o4IaIwI70qV/tPLtCxzvjvpjGLy0dkZVI3Nm4Ikt34dy1PH77+AiuVbjUT5aUqYCTig==
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: <vritk0xzfpk6 DOT fsf AT gmail DOT com>
<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>
Message-ID: <8338a995-1bab-9489-55c2-b6eb2e0ac844@cornell.edu>
Date: Mon, 17 Aug 2020 15:06:51 -0400
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101
Thunderbird/68.11.0
In-Reply-To: <20200817181359.GI3272@calimero.vinschen.de>
X-ClientProxiedBy: BL1PR13CA0025.namprd13.prod.outlook.com
(2603:10b6:208:256::30) To MN2PR04MB6176.namprd04.prod.outlook.com
(2603:10b6:208:e3::13)
MIME-Version: 1.0
X-MS-Exchange-MessageSentRepresentingType: 1
X-Originating-IP: [2604:6000:b407:7f00:6ddb:1b9b:deef:3580]
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id: ebf2d43a-7ae9-4c73-2e10-08d842e0b3dd
X-MS-TrafficTypeDiagnostic: MN2PR04MB5773:
X-Microsoft-Antispam-PRVS: <MN2PR04MB5773DF34A9FAC7DA17D070BED85F0 AT MN2PR04MB5773 DOT namprd04 DOT prod DOT outlook DOT com>
X-MS-Oob-TLC-OOBClassifiers: OLM:9508;
X-MS-Exchange-SenderADCheck: 1
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: mV1Duf0HSZWFzXq04qtBGb35wPedPu2FkfbLu7cz/QgmJcrt/7NZPHB/QJwkRjk3DNs1eaT3ykUIuKzw9Ebj/JfOpnCAS5nMgL0QaNu5Ndt08vy2OuWZwPVdMy1XhPAWqOuUm7kKSJBQNUscJ2BMiMVDNS8TqmuqKzZOdN0ssamYL3jRbyw3jrmhrC64pOFLmairrpQtGtyRf+GfnOjpufqxRhav/NOTlr1SKkwcOr690TDbHv45CXCnaVWSlWHlsZFMG0CdBSU0Q7DCa87dNkOtCcBfDRXo/OjbFI/KwuZGpSIMSABh6bMAx2ih2DAwwAbR28UjDw0Mo4UfJ4Dm5kTIX7bm6h/XZgM1YJkAZ+39iIPaF5vwkNziHAiywPok
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)(366004)(376002)(396003)(346002)(136003)(75432002)(2616005)(6486002)(5660300002)(31696002)(31686004)(8676002)(86362001)(52116002)(36756003)(66556008)(316002)(478600001)(8936002)(66946007)(2906002)(186003)(786003)(16526019)(6916009)(66476007)(53546011)(43740500002);
DIR:OUT; SFP:1102;
X-MS-Exchange-AntiSpam-MessageData: XAfGjuJN1m0W2eBSfpQ4XnsRAoPX4ZwffmJvzfE8Mn518CAzfiY7hSkZkEK711cJGc1BHMKNT8V161WRWVrrWrMZ8g3GLvEdMlOh1SLtMNcEc8mNbIZNIx2ZLX8thGLBa5tb61qLgHc++fTDLjcOL2KplEtamoRwOsJSJd26U8h4DaORrt/MjfOVj+O55PE/qlBeJFfrqWKNlsrLj8cxbESjCeimrrMknfHYXBsoPItZzTvijfcVb/HBCAbbWa1ocToZ7agorOHPK1wI4WbNEpQy11QVXOTQAZfX07dFNRLj6P3r5Twn9RvuDteS1rsnshMjEvQNAKZLJgI9omdg8aZCA889KuMb8z/Y0ihFJVhYh8plBdzLoHqcig/caJ7dI0lhjAzlkAMT3GMuKQmqV+cSRknygUWIarWBVAmdF6OyCVPL1pCJu67dbxomBsM4YCSC4fJ78HqGkvL21SK/5MS1Ecj7eYkrv+uJK7EkJLTVWXrqVoQk3M8hMPZa2+JpFa6tg63c3Ov9HD1TwXq2rhqwg2j4qp/q8Mf/bVIDqJYMjdy7o1HJQQ9KCaWYL2B+4BGqyAHox1e6A4ERqDJ4T8oqF7nioGkCnX6W2vC/w00lt8MaY4lrb35pMY52ChCi73oy728RvZXfpIHtPENN0BZgPG/2znTczwFyuuBxOFwB0oysMOK90LMzcq+AqK7WSzHVAL50cvVHzaeIhUY3+Q==
X-OriginatorOrg: cornell.edu
X-MS-Exchange-CrossTenant-Network-Message-Id: ebf2d43a-7ae9-4c73-2e10-08d842e0b3dd
X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB6176.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2020 19:06:53.2238 (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: a7r7lkq4RKfUAXbi7aB2kYcpU23Bg7S4lGvQbSip0Dam9Kqy2bMXkM1Qcm8Pn2um/aQrwRExwKcA7mC32tycoA==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5773
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,
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
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Ken Brown via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Ken Brown <kbrown AT cornell DOT edu>
Errors-To: cygwin-bounces AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id 07HJ7X1g031747

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.

I'd be willing to take a crack at this if no one more knowledgeable steps 
forward.  But keep in mind that I've never looked at the gcc code or Cygwin's 
exception handler until today, so I'm not necessarily the best person to do this.

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019