From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#65726: 29.1.50; Crash in regexp engine Date: Sat, 16 Sep 2023 12:49:58 +0200 Message-ID: <65105BCA-1884-4673-A8F8-03E3C7ABAAEA@gmail.com> References: <8e1b4e50-0430-3eb3-e486-60def1e4821f@gmx.at> <83fs3u5e7u.fsf@gnu.org> <835y4q5apw.fsf@gnu.org> <776370AB-662F-4C0A-95BF-97DEA4F18F54@gmail.com> <3A0AC9E2-A420-47B6-870A-69C53FCAEF71@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19127"; mail-complaints-to="usenet@ciao.gmane.io" Cc: martin rudalics , Eli Zaretskii , 65726@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 16 12:51:06 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qhStF-0004mq-NZ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Sep 2023 12:51:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhSt6-0003od-IR; Sat, 16 Sep 2023 06:50:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhSt5-0003oM-Ke for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 06:50:55 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhSt5-0007fH-CX for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 06:50:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qhStC-0004s9-Ao for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 06:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Sep 2023 10:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65726 X-GNU-PR-Package: emacs Original-Received: via spool by 65726-submit@debbugs.gnu.org id=B65726.169486141818677 (code B ref 65726); Sat, 16 Sep 2023 10:51:02 +0000 Original-Received: (at 65726) by debbugs.gnu.org; 16 Sep 2023 10:50:18 +0000 Original-Received: from localhost ([127.0.0.1]:45498 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhSsU-0004rB-0F for submit@debbugs.gnu.org; Sat, 16 Sep 2023 06:50:18 -0400 Original-Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]:44255) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhSsP-0004qr-39 for 65726@debbugs.gnu.org; Sat, 16 Sep 2023 06:50:17 -0400 Original-Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b974031aeaso48349891fa.0 for <65726@debbugs.gnu.org>; Sat, 16 Sep 2023 03:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694861400; x=1695466200; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=ILr4WwxkGGk3v63PvkO7x/DSwulaSidDrfYyNjD2y74=; b=OB2pSu4NHhWTQxtx/YupgfWmS/pW/ThH9OXw9jCoP5ycCbF69Cycl/4qB/Yi30IsCO w0USM9nfGLEyWf+bJ+BCe6NWtjAp+zREGnb/UDatAoF/xpghgrXheMm6IsijZojcWFOZ NENNuFMpa0XtyPuo2NIr4bqcDRtv7+eMxP/oBSGKfCTE8n76X68Jf4XzHR4NtmU8cgcb NjWMs1PrJUPWKupSd0PFW+LAjOn532/zJoycNSg5+vMnv/UZTfjo5amFh0PFQ5/1zBWs OTOnw/c/oDZsyHfL+VPE4EYC0knhq3iUShF7cY2ydcUrbFpJUZpF2ZtHxS0YLgoG6hRW T8eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694861400; x=1695466200; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ILr4WwxkGGk3v63PvkO7x/DSwulaSidDrfYyNjD2y74=; b=w4fbtsYWgNKh/1Lj+bR9X0J8AwjLU321GGCYQdefqKl+WyxZXNIniHBdsdHoyc8yvW frb5D2of54975wpEaBVwkfaK7ulwTweV0hHK3CgiaduaVCpT1jbETwVeAyuwusWgg27H bn0xD3NOZDpgFdg+afnefE/jezD3zcZ+qEwcAbe2FnKCmKnR9mZZRPglZ5g4H7jSLwNx HYY1MTKcMR6Cah/Ylu1PjUS5Tm4MDT3QiErvXroZy3SCVwQ0cw/8Jg00IwMnXFASKNLN ZM8V7ylc/nh0PgQ9D9jLnPpKfea1iw0uLpGz0oBLkQdz2/TG4wlQsRx4CdkmlH6RPO6x eVdQ== X-Gm-Message-State: AOJu0YxIx4uMHoT2G2kVhZsqPBFxGR1D80A3D1HfOW1HgFOHrX212DWl VaKM1YGygwAHcr/svYqTf/g= X-Google-Smtp-Source: AGHT+IHohh04fCnQGS84Y7EHucrQYGZ9P8YY7eUgwmsG3Yaz0BCSoFpAfxpNEhvkp4YULdMPs33eww== X-Received: by 2002:a05:6512:4003:b0:500:b63f:4db3 with SMTP id br3-20020a056512400300b00500b63f4db3mr4414594lfb.35.1694861399900; Sat, 16 Sep 2023 03:49:59 -0700 (PDT) Original-Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id x13-20020ac25dcd000000b00502d555fb80sm972025lfq.119.2023.09.16.03.49.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Sep 2023 03:49:59 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3654.120.0.1.15) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270606 Archived-At: 16 sep. 2023 kl. 05.45 skrev Stefan Monnier : >>> (At this point >>> someone will inevitably point out a helpful invariant that is = obvious >>> in hindsight. This is just my cunning attempt at making that = happen.) >=20 > I think I have a "helpful invariant", finally: Everything is proceeding as I have foreseen. > Because of how we build our code, when we're at an `on_failure_jump` = the > two branches can either both go forward (typically for a "|" or a = "?"), > or *one* of them goes backward the other forward (for loops), where = the > one that goes backward (i.e. `p2 <=3D p2_orig`) is the edge (call it > `p2_loop`) that goes back to the beginning of the loop and the other > (call it `p2_exit`) is the one that exits the loop. >=20 > Now, because our loops are nested with proper "structured = programming", > there can't be any jump from within the loop to outside the loop = except > for the current jump. And there can't be any jump from outside the = loop > to inside the loop except by entering via `p2_loop`. >=20 > Since we have two recursive calls to `mutually_exclusive_p` (one for > `p2_exit` and one for `p2_loop`) and each one only needs to check = those > positions not checked by the other, we can say that `p2_loop` only = needs > to check the positions within the loop (i.e. between `p2_loop` and > `p2_exit`) and can presume that *all* other positions are checked by = the > other recursive call (the one that starts at `p2_exit`). >=20 > So I think a single arg `done_end` (set, like the current `done_end`, = to > `p2_loop` when recursing into `p2_loop`) is indeed sufficient: there's > no way to go from `p2_loop` to before `p2_loop` without first going to > `p2_exit` (which is already checked by the other call). I think you are right, but wouldn't mind seeing it confirmed = empirically. Say, by cross-checking using an an alternative (slower) = implementation that directly checks whether a node has been visited = before.