From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#58217: tree-il->bytecode compilation of (not (list =?UTF-8?Q?=E2=80=A6?=)) fails Date: Sat, 01 Oct 2022 12:27:30 +0200 Message-ID: <87sfk7g7ot.fsf@inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35474"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) To: 58217@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat Oct 01 12:28:17 2022 Return-path: Envelope-to: guile-bugs@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 1oeZjF-00090t-Do for guile-bugs@m.gmane-mx.org; Sat, 01 Oct 2022 12:28:17 +0200 Original-Received: from localhost ([::1]:50784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oeZjD-0002gi-Qp for guile-bugs@m.gmane-mx.org; Sat, 01 Oct 2022 06:28:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeZj1-0002fn-AB for bug-guile@gnu.org; Sat, 01 Oct 2022 06:28:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44665) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oeZj0-0003rQ-PI for bug-guile@gnu.org; Sat, 01 Oct 2022 06:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oeZj0-0004Gj-DV for bug-guile@gnu.org; Sat, 01 Oct 2022 06:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 01 Oct 2022 10:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58217 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166462006216380 (code B ref -1); Sat, 01 Oct 2022 10:28:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Oct 2022 10:27:42 +0000 Original-Received: from localhost ([127.0.0.1]:43743 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeZig-0004G8-7p for submit@debbugs.gnu.org; Sat, 01 Oct 2022 06:27:42 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:55020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oeZid-0004Fy-NV for submit@debbugs.gnu.org; Sat, 01 Oct 2022 06:27:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeZid-0002ea-1T for bug-guile@gnu.org; Sat, 01 Oct 2022 06:27:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeZic-0003qG-Nt for bug-guile@gnu.org; Sat, 01 Oct 2022 06:27:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=oufHdobOij4emUpRCxxxUcCZ9hVe+ar+QJV8leTXods=; b=HbB5CxgSjQf37c jqcSUn3NFUTqiE+GozNqs8meNud6x4bg//9DBU0qbxrh1OIAtqcKazfzNzrdriles3samRkRwZ23p zdE+aloDg4VHAzlvOo7LE9UaUrE6E0kW+y++mjMCjekW2boXD8dasc9mFkTo61IoSnpCBOREnOHBz ntOQsIHzdCHq7wrMR/DSk4Q5iU0Rr0TQG4YDmZLuD6kBd0XXDAOssDHubjrInoNe7EPqK9ZvgMWOz EdpX7xSQassBm/scfNBTNQkgwshI+FF5vU36zyfeglhPVStAfJqszHJIWkLShBQ4u725c3xc7V2hs 1nZSC4oTmdxNYSxOgfIg==; Original-Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:56268 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oeZiX-0000j4-2z for bug-guile@gnu.org; Sat, 01 Oct 2022 06:27:37 -0400 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: =?UTF-8?Q?D=C3=A9cadi?= 10 =?UTF-8?Q?Vend=C3=A9miaire?= an 231 de la =?UTF-8?Q?R=C3=A9volution, ?= jour de la Cuve X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10386 Archived-At: Hi, I stumbled upon this bug of the baseline compiler: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (compile '(not (list 1 2)) #:optimization-level 2) $3 =3D #f scheme@(guile-user)> (compile '(not (list 1 2)) #:optimization-level 1) ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure struct-vtable: Wrong type argument in position 1 (expecting st= ruct): #f Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]> ,bt In system/base/compile.scm: 352:28 5 (compile _ #:from _ #:to _ #:env _ #:optimization-level _ #:wa= rning-level _ #:opts _) 265:44 4 (_ _ _) 261:27 3 (_ _ _) In language/tree-il/compile-bytecode.scm: 1386:14 2 (compile-bytecode # # =E2=80=A6) 412:30 1 (_ _) In ice-9/boot-9.scm: 1685:16 0 (raise-exception _ #:continuable? _) scheme@(guile-user) [1]> (version) $4 =3D "3.0.8" --8<---------------cut here---------------end--------------->8--- The exception is raised in the =E2=80=98predicate?=E2=80=99 call below, whe= re (lookup-primitive 'list) returns #f: (define (finish-conditional exp) (define (true? x) (match x (($ _ val) val) (_ #f))) (define (false? x) (match x (($ _ val) (not val)) (_ #f))) (define (predicate? name) (primitive-predicate? (lookup-primitive name)= )) (match exp (($ src ($ _ test (? true?) (? false?)) consequent alternate) (finish-conditional (make-conditional src test consequent alternate)= )) (($ src ($ _ test (? false?) (? true?)) consequent alternate) (finish-conditional (make-conditional src test alternate consequent)= )) (($ src ($ _ (? predicate?))) exp) (($ src test consequent alternate) (make-conditional src (make-primcall src 'false? (list test)) alternate consequent)))) I believe this is fixed by changing =E2=80=98predicate?=E2=80=99 to: (define (predicate? name) (and=3D> (lookup-primitive name) primitive-predicate?)) Thoughts? Ludo=E2=80=99.