From unknown Sun Jun 22 08:06:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46540: 28.0.50; Native-comp optimization bug Resent-From: Yu Han Quek Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Feb 2021 19:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46540 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 46540@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16134167782342 (code B ref -1); Mon, 15 Feb 2021 19:20:02 +0000 Received: (at submit) by debbugs.gnu.org; 15 Feb 2021 19:19:38 +0000 Received: from localhost ([127.0.0.1]:38720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBjPG-0000bi-B5 for submit@debbugs.gnu.org; Mon, 15 Feb 2021 14:19:38 -0500 Received: from lists.gnu.org ([209.51.188.17]:48884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBjPE-0000bZ-HT for submit@debbugs.gnu.org; Mon, 15 Feb 2021 14:19:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBjPE-0005ie-CH for bug-gnu-emacs@gnu.org; Mon, 15 Feb 2021 14:19:36 -0500 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]:45338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lBjPA-00036x-Pt for bug-gnu-emacs@gnu.org; Mon, 15 Feb 2021 14:19:36 -0500 Received: by mail-oi1-x22c.google.com with SMTP id q186so4849827oig.12 for ; Mon, 15 Feb 2021 11:19:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=b1iU4tsicfBSXZxr1D5Mts+e/7/76nohQDtSFDCzkzs=; b=PaHqp4N8dXYNVLIU3e5y/suPXNEYk3d46eCiTpYX51aKjycjpcuo5YVE1aRxvRX9E0 JwhWp2JdHBJ1iQ4Vph0DWhTeKKIjObeO/ndvkn7M//28xC3KiJ/0wkuM5CSsQOxGMj1e Cs2YB2u9PdunztNUKH8w6ZsHScINZTmX/RnKspSRfBwN1uTgifcCAb3QNWgqO3hHQ3nx n6fK+oMWtnqrwc94JrMDnIECxL5jvuh6YUwUBawun1N3XcDkBKwbwMnWCrNufdYuOP0+ CQcFarbRINPTl/WVsUJvIr0HvdUk78zkC2Z7y//B5if5DpuFsdyuYdoK4+hHUuK6zLAL 6gLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=b1iU4tsicfBSXZxr1D5Mts+e/7/76nohQDtSFDCzkzs=; b=A06G28Ui8Mr2AWTUDrCkZaiA0wGRKdJeGvr3sGtCEsvb7zNIzxDhtDm/wSjnLQSW+v 7vE6qhhmsr9qHle97HWpapeP7p5u6VPVrAEkcvJEUAn81kihq2KltDILFl8tw12Et2cz yMGVAq7L6x1DywOMG2a0VzEPj6MifypbTdIPyGXGIINgeM87oOO1DARZs/9BeUN1sUiG IcjfVCjDi2n/URIZB3aQDivBnHQsUK538U5Z5fmPlzANULnj4YbAYwMcQrvjpnk1CWCf 5gR6JKia+dX/3KwI/4nKUWmZJge+3BZpiWPjUZZ0Lbia4r6/wK14gfQXyziOUtf9GBQh D6mg== X-Gm-Message-State: AOAM532Oj4W9R8+72R23lJpdK5Hn3PBBqpb8ru5b1kDuwkrzCyYq54EJ xZXdG6uxZ3N4PCtZH2iF59GB4Cd7Ly8FDDpg9zmK/2CuiKanew== X-Google-Smtp-Source: ABdhPJyZlgNTCB1yLDyKV0cKtGTibFbFI6yFi0UUkIFoh1BZT31tzgrhoGKHp3pE8HX4nCpaaHLIUG0gNU2OMEZwxjU= X-Received: by 2002:aca:5988:: with SMTP id n130mr308664oib.60.1613416770971; Mon, 15 Feb 2021 11:19:30 -0800 (PST) MIME-Version: 1.0 From: Yu Han Quek Date: Tue, 16 Feb 2021 03:19:18 +0800 Message-ID: Content-Type: multipart/alternative; boundary="000000000000822db505bb64ddff" Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=qythium@gmail.com; helo=mail-oi1-x22c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --000000000000822db505bb64ddff Content-Type: text/plain; charset="UTF-8" The following function gives an incorrect result when compiled natively with comp-speed >= 2. ;; -*- lexical-binding: t; -*- (defun native-comp-bug (body) (let ((x (car body)) (y (cadr body))) (unless (and (natnump x) (natnump y) (<= x y)) (error "")) x)) (native-comp-bug '(3 4)) ;; Expected result: 3 ;; Actual result: 0 The car of the argument is ignored and treated as 0. This appears to be a minimal repro, manually shrunk from the original function discovered in rx.el (rx--translate-bounded-repetition). If either lexical binding, natnump/inequality checks, or error form is removed, the function behaves as expected. Setting comp-speed to 0 or 1 also causes the function to behave as expected, but setting it to 2 or 3 produces the error. In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.2.0, NS appkit-2022.20 Version 11.1 (Build 20C69)) of 2021-02-03 built on QYH2.local Repository revision: e56c26d06f72b58acdc59c7e2958be9b691d3e78 Repository branch: master System Description: macOS 11.2.1 Configured using: 'configure --with-ns --with-modules '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-xwidgets --with-nativecomp --without-rsvg 'CFLAGS=-I/usr/local/opt/gcc/include -O2 -march=native' 'LDFLAGS=-L/usr/local/opt/gcc/lib/gcc/10 -L/usr/local/opt/libgccjit/lib/gcc/10 -L/usr/local/opt/gcc/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0 -I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include'' Configured features: ACL GIF GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG THREADS TIFF TOOLKIT_SCROLL_BARS XWIDGETS ZLIB Important settings: value of $LC_ALL: en_US.UTF-8 value of $LC_CTYPE: UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs auth-source eieio eieio-core eieio-loaddefs password-cache json map text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils term/xterm xterm comp comp-cstr warnings subr-x rx cl-seq cl-macs cl-extra help-mode easymenu seq byte-opt gv cl-loaddefs cl-lib bytecomp byte-compile cconv iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face pcase macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads xwidget-internal kqueue cocoa ns lcms2 multi-tty make-network-process nativecomp emacs) Memory information: ((conses 16 79127 4281) (symbols 48 8088 1) (strings 32 20784 4357) (string-bytes 1 680668) (vectors 16 13082) (vector-slots 8 220094 8657) (floats 8 27 13) (intervals 56 213 0) (buffers 984 11)) --000000000000822db505bb64ddff Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

The following function gives an incorrect result when = compiled natively
with comp-speed >=3D 2.

;; -*- lexical-bindi= ng: t; -*-

(defun native-comp-bug (body)
=C2=A0 (let ((x (car bod= y))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (y (cadr body)))
=C2=A0 =C2=A0 (unles= s (and
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(natnump x)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(natnump y)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(<=3D x y))
=C2=A0 =C2=A0 =C2= =A0 (error ""))
=C2=A0 =C2=A0 x))

(native-comp-bug '= ;(3 4))

;; Expected result: 3
;; Actual result: 0

The car = of the argument is ignored and treated as 0.

This appears to be a mi= nimal repro, manually shrunk from the original function
discovered in rx= .el (rx--translate-bounded-repetition).

If either lexical binding, n= atnump/inequality checks, or error form is removed,
the function behaves= as expected.

Setting comp-speed to 0 or 1 also causes the function = to behave as expected, but
setting it to 2 or 3 produces the error.
<= br>In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.2.0, NS appkit-2022= .20 Version 11.1 (Build 20C69))
=C2=A0of 2021-02-03 built on QYH2.local<= br>Repository revision: e56c26d06f72b58acdc59c7e2958be9b691d3e78
Reposit= ory branch: master
System Description: =C2=A0macOS 11.2.1

Configu= red using:
=C2=A0'configure --with-ns --with-modules
=C2=A0'-= -enable-locallisppath=3D/Library/Application
=C2=A0Support/Emacs/${versi= on}/site-lisp:/Library/Application
=C2=A0Support/Emacs/site-lisp' --= with-xwidgets --with-nativecomp
=C2=A0--without-rsvg 'CFLAGS=3D-I/us= r/local/opt/gcc/include -O2 -march=3Dnative'
=C2=A0'LDFLAGS=3D-L= /usr/local/opt/gcc/lib/gcc/10
=C2=A0-L/usr/local/opt/libgccjit/lib/gcc/1= 0
=C2=A0-L/usr/local/opt/gcc/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0=
=C2=A0-I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include&#= 39;'

Configured features:
ACL GIF GMP GNUTLS JPEG JSON LCMS2 = LIBXML2 MODULES NATIVE_COMP NOTIFY
KQUEUE NS PDUMPER PNG THREADS TIFF TO= OLKIT_SCROLL_BARS XWIDGETS ZLIB

Important settings:
=C2=A0 value = of $LC_ALL: en_US.UTF-8
=C2=A0 value of $LC_CTYPE: UTF-8
=C2=A0 value= of $LANG: en_US.UTF-8
=C2=A0 locale-coding-system: utf-8-unix

Ma= jor mode: Lisp Interaction

Minor modes in effect:
=C2=A0 tooltip-= mode: t
=C2=A0 global-eldoc-mode: t
=C2=A0 eldoc-mode: t
=C2=A0 el= ectric-indent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode= : t
=C2=A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2=A0= global-font-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-curso= r-mode: t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode= : t
=C2=A0 auto-compression-mode: t
=C2=A0 line-number-mode: t
=C2= =A0 transient-mark-mode: t

Load-path shadows:
None found.

= Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-l= oaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmailrmail-loaddefs auth-source eieio eieio-core eieio-loaddefs
password-cac= he json map text-property-search time-date mm-decode
mm-bodies mm-encode= mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc= 2045 ietf-drums mm-util mail-prsvr mail-utils
term/xterm xterm comp comp= -cstr warnings subr-x rx cl-seq cl-macs
cl-extra help-mode easymenu seq = byte-opt gv cl-loaddefs cl-lib bytecomp
byte-compile cconv iso-transl to= oltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel= term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd= fontset image regexp-opt fringe
tabulated-list replace newcomment text-= mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-e= shadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax f= acemenu font-core
term/tty-colors frame minibuffer cl-generic cham georg= ian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean jap= anese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethio= pic indian
cyrillic chinese composite charscript charprop case-table epa= -hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice butt= on
loaddefs faces cus-face pcase macroexp files window text-propertiesoverlay sha1 md5 base64 format env code-pages mule custom widget
hasht= able-print-readable backquote threads xwidget-internal kqueue cocoa
ns l= cms2 multi-tty make-network-process nativecomp emacs)

Memory informa= tion:
((conses 16 79127 4281)
=C2=A0(symbols 48 8088 1)
=C2=A0(str= ings 32 20784 4357)
=C2=A0(string-bytes 1 680668)
=C2=A0(vectors 16 1= 3082)
=C2=A0(vector-slots 8 220094 8657)
=C2=A0(floats 8 27 13)
= =C2=A0(intervals 56 213 0)
=C2=A0(buffers 984 11))
--000000000000822db505bb64ddff-- From unknown Sun Jun 22 08:06:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46540: 28.0.50; Native-comp optimization bug Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Feb 2021 20:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46540 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yu Han Quek Cc: 46540@debbugs.gnu.org Received: via spool by 46540-submit@debbugs.gnu.org id=B46540.161341974115816 (code B ref 46540); Mon, 15 Feb 2021 20:09:02 +0000 Received: (at 46540) by debbugs.gnu.org; 15 Feb 2021 20:09:01 +0000 Received: from localhost ([127.0.0.1]:38777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBkB2-000471-TY for submit@debbugs.gnu.org; Mon, 15 Feb 2021 15:09:01 -0500 Received: from mx.sdf.org ([205.166.94.24]:49199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBkAx-00046k-QY for 46540@debbugs.gnu.org; Mon, 15 Feb 2021 15:08:59 -0500 Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 11FK8s7E015833 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Mon, 15 Feb 2021 20:08:55 GMT From: Andrea Corallo References: Date: Mon, 15 Feb 2021 20:08:54 +0000 In-Reply-To: (Yu Han Quek's message of "Tue, 16 Feb 2021 03:19:18 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yu Han Quek writes: > The following function gives an incorrect result when compiled natively > with comp-speed >= 2. > > ;; -*- lexical-binding: t; -*- > > (defun native-comp-bug (body) > (let ((x (car body)) > (y (cadr body))) > (unless (and > (natnump x) > (natnump y) > (<= x y)) > (error "")) > x)) Cool thanks for the reduced reproducer! I'll have a in the coming days. Andrea From unknown Sun Jun 22 08:06:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46540: 28.0.50; Native-comp optimization bug Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Feb 2021 21:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46540 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 46540@debbugs.gnu.org Cc: qythium@gmail.com X-Debbugs-Original-To: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: 46540@debbugs.gnu.org, Yu Han Quek Received: via spool by submit@debbugs.gnu.org id=B.161351181728428 (code B ref -1); Tue, 16 Feb 2021 21:44:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Feb 2021 21:43:37 +0000 Received: from localhost ([127.0.0.1]:41846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lC889-0007OS-BW for submit@debbugs.gnu.org; Tue, 16 Feb 2021 16:43:37 -0500 Received: from lists.gnu.org ([209.51.188.17]:48860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lC888-0007OL-53 for submit@debbugs.gnu.org; Tue, 16 Feb 2021 16:43:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC887-0005PN-Th for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2021 16:43:35 -0500 Received: from mx.sdf.org ([205.166.94.24]:63478) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lC884-00065F-U0 for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2021 16:43:35 -0500 Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 11GLhThc005737 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Tue, 16 Feb 2021 21:43:29 GMT From: Andrea Corallo References: Date: Tue, 16 Feb 2021 21:43:29 +0000 In-Reply-To: (Andrea Corallo via's message of "Mon, 15 Feb 2021 20:08:54 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=205.166.94.24; envelope-from=akrl@sdf.org; helo=mx.sdf.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" writes: > Yu Han Quek writes: > >> The following function gives an incorrect result when compiled natively >> with comp-speed >= 2. >> >> ;; -*- lexical-binding: t; -*- >> >> (defun native-comp-bug (body) >> (let ((x (car body)) >> (y (cadr body))) >> (unless (and >> (natnump x) >> (natnump y) >> (<= x y)) >> (error "")) >> x)) > > Cool thanks for the reduced reproducer! > > I'll have a in the coming days. > > Andrea Ok here a slightly simplified reproducer: ;; -*- lexical-binding: t; -*- (defun native-comp-bug (x y) (if (and (natnump x) (natnump y) (<= x y)) x (error ""))) The following constrain insn clearly resolves in the wrong way: (assume #(mvar 79140560 0 (integer 0 0)) (<= #(mvar 79118120 0 (integer 0 *)) #(mvar 79118988 3 (integer 0 *)))) Will come-up with a fix. Andrea From unknown Sun Jun 22 08:06:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46540: 28.0.50; Native-comp optimization bug Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Feb 2021 07:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46540 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Andrea Corallo Cc: 46540@debbugs.gnu.org, qythium@gmail.com Received: via spool by 46540-submit@debbugs.gnu.org id=B46540.161354824414289 (code B ref 46540); Wed, 17 Feb 2021 07:51:02 +0000 Received: (at 46540) by debbugs.gnu.org; 17 Feb 2021 07:50:44 +0000 Received: from localhost ([127.0.0.1]:42380 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCHbf-0003iP-R0 for submit@debbugs.gnu.org; Wed, 17 Feb 2021 02:50:43 -0500 Received: from mail-ot1-f45.google.com ([209.85.210.45]:35276) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCHbe-0003iC-IK for 46540@debbugs.gnu.org; Wed, 17 Feb 2021 02:50:42 -0500 Received: by mail-ot1-f45.google.com with SMTP id 80so2274604oty.2 for <46540@debbugs.gnu.org>; Tue, 16 Feb 2021 23:50:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vKwJBEVcCEraxoBC6oTl1/FD8zBYf8geHovT1xLsQmw=; b=YLbr4BtynaVqYJf7MwEy3EYdSb3gUm5wlOPdpFK2kQE4z7WmZTnzVSE4jf6+gZo6br 0oZMn/bOHQy7MGh8jmyrk0hIsi0L/9WepuaiSx37tLXLhRrCXkajNHY+wTja5S9UddEt MHyTGwZrI/5f6xav+cwrUxTfuCZNPzHJtIfS0ehLMyS1aJgxOgLYVXb3vXPbBiC9ovxl 5bPT3NXPvLTEVq54eK9+gM2kY8zbsE8aaQFY4uicM3WS8nW+LGMj0yajUtlShD1rFKFF EpR+B47bVCuRIM04RF9cJ+IBXD0ik747LccwwUDhhSxfgPy8zTFPevpNZQkqA3bfav8h Px6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vKwJBEVcCEraxoBC6oTl1/FD8zBYf8geHovT1xLsQmw=; b=ghdz/MjTCmzRJH4zhHMs6uaP7c/TVrt6YDdBZ7483jyJP9NnybU6iKfccMWgLETdwu AoHpWZc9KW5hBNKG4rJmHbYhxwXMyTkrNQwl0JsPSmQV8/xAph0dpqPlkTPvLUsizF1r bVCKr7uHX/nLrk3PVvANte2K/WGrKFH7ZZpQAIHY4ebJcplXdZmmE74Ri5j+3tQXm6bD 6i9cVpIQEJnDzT09uMA9J66IgTyRmoXuVzu5jHY9TIRLhN0ndarwNSyYXfsTQAGQQxr+ etRQIzla7D1IxqJt3penizxJ0T3y8A2mWGw5cuVsQnm2OITkNuq1mHzcuJzGAPWeeQR0 uTWA== X-Gm-Message-State: AOAM531q1WmWdvczy2iDP9fy8jGUR2JT0Nm5VPMijwLUdjhRASYZ9LVY hfqeDxPszcIb/NKTqzbR4/0IXocZ1pur8JGohmk= X-Google-Smtp-Source: ABdhPJyCh5hpUDOm44viQPKBas52TTnjtZLwNlpV2IpHMSDoE7754TEFW2lh7+GefKWZ+dBcTgPQRvmk/Uujm9Tm5uU= X-Received: by 2002:a9d:6e92:: with SMTP id a18mr3692723otr.287.1613548236907; Tue, 16 Feb 2021 23:50:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Pip Cet Date: Wed, 17 Feb 2021 07:50:00 +0000 Message-ID: Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Tue, Feb 16, 2021 at 9:44 PM Andrea Corallo wrote: > The following constrain insn clearly resolves in the wrong way: > > (assume #(mvar 79140560 0 (integer 0 0)) (<= #(mvar 79118120 0 (integer 0 *)) #(mvar 79118988 3 (integer 0 *)))) > > Will come-up with a fix. My guess is that this code in comp-cstr.el: (defun comp-cstr-<= (dst old-dst src) "Constraint DST being <= than SRC. SRC can be either a comp-cstr or an integer." (with-comp-cstr-accessors (let ((ext-range (if (integerp src) `((- . ,src)) (when-let* ((range (range src)) (low (comp-cstr-smallest-in-range range)) (okay (integerp low))) `((- . ,low)))))) (comp-cstr-set-cmp-range dst old-dst ext-range)))) should use comp-cstr-greatest-in-range rather than comp-cstr-smallest-in-range. Same for comp-cstr-<. Analogous for comp-cstr->, comp-cstr->=. (If A's possible values are {3, 4, 5}, and B is <= A, we can only conclude B <= 5, not that B <= 3, since A = 5, B = 5 is a solution to the constraint problem). From unknown Sun Jun 22 08:06:24 2025 X-Loop: help-debbugs@gnu.org Subject: bug#46540: 28.0.50; Native-comp optimization bug Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Feb 2021 21:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46540 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: qythium@gmail.com Cc: 46540@debbugs.gnu.org, Pip Cet Received: via spool by 46540-submit@debbugs.gnu.org id=B46540.161359631827174 (code B ref 46540); Wed, 17 Feb 2021 21:12:02 +0000 Received: (at 46540) by debbugs.gnu.org; 17 Feb 2021 21:11:58 +0000 Received: from localhost ([127.0.0.1]:45255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCU74-00074E-5K for submit@debbugs.gnu.org; Wed, 17 Feb 2021 16:11:58 -0500 Received: from mx.sdf.org ([205.166.94.24]:50885) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCU72-000744-2y for 46540@debbugs.gnu.org; Wed, 17 Feb 2021 16:11:57 -0500 Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 11HLBr3B003708 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Wed, 17 Feb 2021 21:11:54 GMT From: Andrea Corallo References: Date: Wed, 17 Feb 2021 21:11:53 +0000 In-Reply-To: (Pip Cet's message of "Wed, 17 Feb 2021 07:50:00 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Pip Cet writes: > On Tue, Feb 16, 2021 at 9:44 PM Andrea Corallo wrote: >> The following constrain insn clearly resolves in the wrong way: >> >> (assume #(mvar 79140560 0 (integer 0 0)) (<= #(mvar 79118120 0 (integer 0 *)) #(mvar 79118988 3 (integer 0 *)))) >> >> Will come-up with a fix. > > My guess is that this code in comp-cstr.el: > > (defun comp-cstr-<= (dst old-dst src) > "Constraint DST being <= than SRC. > SRC can be either a comp-cstr or an integer." > (with-comp-cstr-accessors > (let ((ext-range > (if (integerp src) > `((- . ,src)) > (when-let* ((range (range src)) > (low (comp-cstr-smallest-in-range range)) > (okay (integerp low))) > `((- . ,low)))))) > (comp-cstr-set-cmp-range dst old-dst ext-range)))) > > should use comp-cstr-greatest-in-range rather than > comp-cstr-smallest-in-range. Same for comp-cstr-<. Analogous for > comp-cstr->, comp-cstr->=. > > (If A's possible values are {3, 4, 5}, and B is <= A, we can only > conclude B <= 5, not that B <= 3, since A = 5, B = 5 is a solution to > the constraint problem). Yep, Pip spot on. Small oversight from me... :D 1fe5994bcb should fix. Yu Han Quek would you mind to confirm rx now works as excpected for you? Thanks Andrea From unknown Sun Jun 22 08:06:24 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Yu Han Quek Subject: bug#46540: closed (Re: bug#46540: 28.0.50; Native-comp optimization bug) Message-ID: References: X-Gnu-PR-Message: they-closed 46540 X-Gnu-PR-Package: emacs Reply-To: 46540@debbugs.gnu.org Date: Thu, 18 Feb 2021 08:02:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1613635322-1473-1" This is a multi-part message in MIME format... ------------=_1613635322-1473-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #46540: 28.0.50; Native-comp optimization bug which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 46540@debbugs.gnu.org. --=20 46540: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D46540 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1613635322-1473-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 46540-done) by debbugs.gnu.org; 18 Feb 2021 08:01:57 +0000 Received: from localhost ([127.0.0.1]:45827 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCeG5-0000NV-Hv for submit@debbugs.gnu.org; Thu, 18 Feb 2021 03:01:57 -0500 Received: from mx.sdf.org ([205.166.94.24]:57495) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lCeG4-0000NM-GW for 46540-done@debbugs.gnu.org; Thu, 18 Feb 2021 03:01:57 -0500 Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 11I81qNJ021225 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Thu, 18 Feb 2021 08:01:53 GMT From: Andrea Corallo To: Yu Han Quek Subject: Re: bug#46540: 28.0.50; Native-comp optimization bug References: Date: Thu, 18 Feb 2021 08:01:52 +0000 In-Reply-To: (Yu Han Quek's message of "Thu, 18 Feb 2021 15:11:22 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 46540-done Cc: 46540-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) [re-adding the bug in Cc] Yu Han Quek writes: [...] > Yep, Pip spot on. Small oversight from me... :D > > 1fe5994bcb should fix. > > Yu Han Quek would you mind to confirm rx now works as excpected for you? > > Thanks > > Andrea > > Thanks for the quick fix! I can confirm that the rx issue I ran into (rx (repeat 4 5 ?a)) now works as expected :) Nice, closing then. Thanks for reporting and testing! Andrea ------------=_1613635322-1473-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 15 Feb 2021 19:19:38 +0000 Received: from localhost ([127.0.0.1]:38720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBjPG-0000bi-B5 for submit@debbugs.gnu.org; Mon, 15 Feb 2021 14:19:38 -0500 Received: from lists.gnu.org ([209.51.188.17]:48884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lBjPE-0000bZ-HT for submit@debbugs.gnu.org; Mon, 15 Feb 2021 14:19:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBjPE-0005ie-CH for bug-gnu-emacs@gnu.org; Mon, 15 Feb 2021 14:19:36 -0500 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]:45338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lBjPA-00036x-Pt for bug-gnu-emacs@gnu.org; Mon, 15 Feb 2021 14:19:36 -0500 Received: by mail-oi1-x22c.google.com with SMTP id q186so4849827oig.12 for ; Mon, 15 Feb 2021 11:19:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=b1iU4tsicfBSXZxr1D5Mts+e/7/76nohQDtSFDCzkzs=; b=PaHqp4N8dXYNVLIU3e5y/suPXNEYk3d46eCiTpYX51aKjycjpcuo5YVE1aRxvRX9E0 JwhWp2JdHBJ1iQ4Vph0DWhTeKKIjObeO/ndvkn7M//28xC3KiJ/0wkuM5CSsQOxGMj1e Cs2YB2u9PdunztNUKH8w6ZsHScINZTmX/RnKspSRfBwN1uTgifcCAb3QNWgqO3hHQ3nx n6fK+oMWtnqrwc94JrMDnIECxL5jvuh6YUwUBawun1N3XcDkBKwbwMnWCrNufdYuOP0+ CQcFarbRINPTl/WVsUJvIr0HvdUk78zkC2Z7y//B5if5DpuFsdyuYdoK4+hHUuK6zLAL 6gLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=b1iU4tsicfBSXZxr1D5Mts+e/7/76nohQDtSFDCzkzs=; b=A06G28Ui8Mr2AWTUDrCkZaiA0wGRKdJeGvr3sGtCEsvb7zNIzxDhtDm/wSjnLQSW+v 7vE6qhhmsr9qHle97HWpapeP7p5u6VPVrAEkcvJEUAn81kihq2KltDILFl8tw12Et2cz yMGVAq7L6x1DywOMG2a0VzEPj6MifypbTdIPyGXGIINgeM87oOO1DARZs/9BeUN1sUiG IcjfVCjDi2n/URIZB3aQDivBnHQsUK538U5Z5fmPlzANULnj4YbAYwMcQrvjpnk1CWCf 5gR6JKia+dX/3KwI/4nKUWmZJge+3BZpiWPjUZZ0Lbia4r6/wK14gfQXyziOUtf9GBQh D6mg== X-Gm-Message-State: AOAM532Oj4W9R8+72R23lJpdK5Hn3PBBqpb8ru5b1kDuwkrzCyYq54EJ xZXdG6uxZ3N4PCtZH2iF59GB4Cd7Ly8FDDpg9zmK/2CuiKanew== X-Google-Smtp-Source: ABdhPJyZlgNTCB1yLDyKV0cKtGTibFbFI6yFi0UUkIFoh1BZT31tzgrhoGKHp3pE8HX4nCpaaHLIUG0gNU2OMEZwxjU= X-Received: by 2002:aca:5988:: with SMTP id n130mr308664oib.60.1613416770971; Mon, 15 Feb 2021 11:19:30 -0800 (PST) MIME-Version: 1.0 From: Yu Han Quek Date: Tue, 16 Feb 2021 03:19:18 +0800 Message-ID: Subject: 28.0.50; Native-comp optimization bug To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="000000000000822db505bb64ddff" Received-SPF: pass client-ip=2607:f8b0:4864:20::22c; envelope-from=qythium@gmail.com; helo=mail-oi1-x22c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --000000000000822db505bb64ddff Content-Type: text/plain; charset="UTF-8" The following function gives an incorrect result when compiled natively with comp-speed >= 2. ;; -*- lexical-binding: t; -*- (defun native-comp-bug (body) (let ((x (car body)) (y (cadr body))) (unless (and (natnump x) (natnump y) (<= x y)) (error "")) x)) (native-comp-bug '(3 4)) ;; Expected result: 3 ;; Actual result: 0 The car of the argument is ignored and treated as 0. This appears to be a minimal repro, manually shrunk from the original function discovered in rx.el (rx--translate-bounded-repetition). If either lexical binding, natnump/inequality checks, or error form is removed, the function behaves as expected. Setting comp-speed to 0 or 1 also causes the function to behave as expected, but setting it to 2 or 3 produces the error. In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.2.0, NS appkit-2022.20 Version 11.1 (Build 20C69)) of 2021-02-03 built on QYH2.local Repository revision: e56c26d06f72b58acdc59c7e2958be9b691d3e78 Repository branch: master System Description: macOS 11.2.1 Configured using: 'configure --with-ns --with-modules '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-xwidgets --with-nativecomp --without-rsvg 'CFLAGS=-I/usr/local/opt/gcc/include -O2 -march=native' 'LDFLAGS=-L/usr/local/opt/gcc/lib/gcc/10 -L/usr/local/opt/libgccjit/lib/gcc/10 -L/usr/local/opt/gcc/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0 -I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include'' Configured features: ACL GIF GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG THREADS TIFF TOOLKIT_SCROLL_BARS XWIDGETS ZLIB Important settings: value of $LC_ALL: en_US.UTF-8 value of $LC_CTYPE: UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs auth-source eieio eieio-core eieio-loaddefs password-cache json map text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils term/xterm xterm comp comp-cstr warnings subr-x rx cl-seq cl-macs cl-extra help-mode easymenu seq byte-opt gv cl-loaddefs cl-lib bytecomp byte-compile cconv iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face pcase macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads xwidget-internal kqueue cocoa ns lcms2 multi-tty make-network-process nativecomp emacs) Memory information: ((conses 16 79127 4281) (symbols 48 8088 1) (strings 32 20784 4357) (string-bytes 1 680668) (vectors 16 13082) (vector-slots 8 220094 8657) (floats 8 27 13) (intervals 56 213 0) (buffers 984 11)) --000000000000822db505bb64ddff Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

The following function gives an incorrect result when = compiled natively
with comp-speed >=3D 2.

;; -*- lexical-bindi= ng: t; -*-

(defun native-comp-bug (body)
=C2=A0 (let ((x (car bod= y))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (y (cadr body)))
=C2=A0 =C2=A0 (unles= s (and
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(natnump x)
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(natnump y)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(<=3D x y))
=C2=A0 =C2=A0 =C2= =A0 (error ""))
=C2=A0 =C2=A0 x))

(native-comp-bug '= ;(3 4))

;; Expected result: 3
;; Actual result: 0

The car = of the argument is ignored and treated as 0.

This appears to be a mi= nimal repro, manually shrunk from the original function
discovered in rx= .el (rx--translate-bounded-repetition).

If either lexical binding, n= atnump/inequality checks, or error form is removed,
the function behaves= as expected.

Setting comp-speed to 0 or 1 also causes the function = to behave as expected, but
setting it to 2 or 3 produces the error.
<= br>In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.2.0, NS appkit-2022= .20 Version 11.1 (Build 20C69))
=C2=A0of 2021-02-03 built on QYH2.local<= br>Repository revision: e56c26d06f72b58acdc59c7e2958be9b691d3e78
Reposit= ory branch: master
System Description: =C2=A0macOS 11.2.1

Configu= red using:
=C2=A0'configure --with-ns --with-modules
=C2=A0'-= -enable-locallisppath=3D/Library/Application
=C2=A0Support/Emacs/${versi= on}/site-lisp:/Library/Application
=C2=A0Support/Emacs/site-lisp' --= with-xwidgets --with-nativecomp
=C2=A0--without-rsvg 'CFLAGS=3D-I/us= r/local/opt/gcc/include -O2 -march=3Dnative'
=C2=A0'LDFLAGS=3D-L= /usr/local/opt/gcc/lib/gcc/10
=C2=A0-L/usr/local/opt/libgccjit/lib/gcc/1= 0
=C2=A0-L/usr/local/opt/gcc/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2.0=
=C2=A0-I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include&#= 39;'

Configured features:
ACL GIF GMP GNUTLS JPEG JSON LCMS2 = LIBXML2 MODULES NATIVE_COMP NOTIFY
KQUEUE NS PDUMPER PNG THREADS TIFF TO= OLKIT_SCROLL_BARS XWIDGETS ZLIB

Important settings:
=C2=A0 value = of $LC_ALL: en_US.UTF-8
=C2=A0 value of $LC_CTYPE: UTF-8
=C2=A0 value= of $LANG: en_US.UTF-8
=C2=A0 locale-coding-system: utf-8-unix

Ma= jor mode: Lisp Interaction

Minor modes in effect:
=C2=A0 tooltip-= mode: t
=C2=A0 global-eldoc-mode: t
=C2=A0 eldoc-mode: t
=C2=A0 el= ectric-indent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode= : t
=C2=A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2=A0= global-font-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-curso= r-mode: t
=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode= : t
=C2=A0 auto-compression-mode: t
=C2=A0 line-number-mode: t
=C2= =A0 transient-mark-mode: t

Load-path shadows:
None found.

= Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-l= oaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmailrmail-loaddefs auth-source eieio eieio-core eieio-loaddefs
password-cac= he json map text-property-search time-date mm-decode
mm-bodies mm-encode= mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc= 2045 ietf-drums mm-util mail-prsvr mail-utils
term/xterm xterm comp comp= -cstr warnings subr-x rx cl-seq cl-macs
cl-extra help-mode easymenu seq = byte-opt gv cl-loaddefs cl-lib bytecomp
byte-compile cconv iso-transl to= oltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel= term/ns-win ns-win ucs-normalize
mule-util term/common-win tool-bar dnd= fontset image regexp-opt fringe
tabulated-list replace newcomment text-= mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-e= shadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax f= acemenu font-core
term/tty-colors frame minibuffer cl-generic cham georg= ian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean jap= anese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethio= pic indian
cyrillic chinese composite charscript charprop case-table epa= -hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice butt= on
loaddefs faces cus-face pcase macroexp files window text-propertiesoverlay sha1 md5 base64 format env code-pages mule custom widget
hasht= able-print-readable backquote threads xwidget-internal kqueue cocoa
ns l= cms2 multi-tty make-network-process nativecomp emacs)

Memory informa= tion:
((conses 16 79127 4281)
=C2=A0(symbols 48 8088 1)
=C2=A0(str= ings 32 20784 4357)
=C2=A0(string-bytes 1 680668)
=C2=A0(vectors 16 1= 3082)
=C2=A0(vector-slots 8 220094 8657)
=C2=A0(floats 8 27 13)
= =C2=A0(intervals 56 213 0)
=C2=A0(buffers 984 11))
--000000000000822db505bb64ddff-- ------------=_1613635322-1473-1--