From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Whatson Newsgroups: gmane.lisp.guile.bugs Subject: bug#57948: Frame bindings referring to non-existent locals Date: Tue, 20 Sep 2022 07:16:14 +0000 Message-ID: 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="14226"; mail-complaints-to="usenet@ciao.gmane.io" To: 57948@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Tue Sep 20 09:20:29 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 1oaXYT-0003Uf-Di for guile-bugs@m.gmane-mx.org; Tue, 20 Sep 2022 09:20:29 +0200 Original-Received: from localhost ([::1]:47028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oaXYS-0000y1-9t for guile-bugs@m.gmane-mx.org; Tue, 20 Sep 2022 03:20:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaXVC-0000EM-Nv for bug-guile@gnu.org; Tue, 20 Sep 2022 03:17:11 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56858) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oaXV8-0005xR-J9 for bug-guile@gnu.org; Tue, 20 Sep 2022 03:17:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oaXV7-0008GE-T1 for bug-guile@gnu.org; Tue, 20 Sep 2022 03:17:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrew Whatson Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 20 Sep 2022 07:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57948 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166365821831739 (code B ref -1); Tue, 20 Sep 2022 07:17:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Sep 2022 07:16:58 +0000 Original-Received: from localhost ([127.0.0.1]:55936 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oaXV3-0008Fr-If for submit@debbugs.gnu.org; Tue, 20 Sep 2022 03:16:57 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:39724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oaXV1-0008Fj-QR for submit@debbugs.gnu.org; Tue, 20 Sep 2022 03:16:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oaXUs-00009m-H8 for bug-guile@gnu.org; Tue, 20 Sep 2022 03:16:51 -0400 Original-Received: from mail-yw1-x112c.google.com ([2607:f8b0:4864:20::112c]:39876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oaXUp-0005uF-Vt for bug-guile@gnu.org; Tue, 20 Sep 2022 03:16:45 -0400 Original-Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-3487d84e477so16690477b3.6 for ; Tue, 20 Sep 2022 00:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date; bh=2/JDHfHQ2QjmRNC8yEeO79sHJnLCb1JRTEq/NKEnV00=; b=ivNqJkzQqHp79vCNHcqi+8jgA0Pgt2wjNBFz8jJlHrWN87MgQtNYwfE8AOhcp2Cqtw 1LhlEasJghGs3L/1H3ew7lOgN8uorypL5qRkyxOlySOIpNWnPVWLE0EB+J2yU20ekKd9 55t3iaGYRoSTd1IzCbCshO3caPaL47rg1QBl5AQ2qrCFAhshlQvOYq2dwsbKZikVMecC ObpdZg9vx/EJt5Dkgx+Lia/6gZtivYUy6q1Eh+xJVVrky/mNv8Z+xAmT5OIBjWTLYeL2 kDszwICGjHacYq1yq2OF1hXe8Nwzb1L03jc+IwcB1qUJvvFP3Hs3+37OWSSI++M/8O7D x/jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=2/JDHfHQ2QjmRNC8yEeO79sHJnLCb1JRTEq/NKEnV00=; b=yHNinOHrqF3e5q5PE0ktci4vQj2+b79EbbqZ3AIxkr7JFBXjQKh4V+Lp9OaYr7n3CM YorKtFYtE5C1jGwRJ+cHdo/FBA/zAE9dTULojwdeEXvqepTSflAI7CPRnb1iMgu+beYZ +Wx9g4B5u8/PpAcoKUmBXf81OEMRGqzBZh83zIOkNk981rEIHpDrqVGRKyR9gaHYMtW2 yA9Z+AGTw2ZfsQ8Y8colZNdlsx73yjeadf3BsOxG9ymFuG1PvmdjjY9l5oshzDilMj+l aV3dW7gMhLs/PlsJz1Tv4ZYeigfqPjIjuE/czppUFRDs8J/UV6ardAvuhcHaKANx5ZNU oYuw== X-Gm-Message-State: ACrzQf0EZBb8RzIk3q42lD9gvYKFY4DndigO4qhPa5d34Ejh5zLHXhou 2V1Bfy4KyNCoVJkMKrKt4mUAC94jV5xf394nD+SauFsVvUI= X-Google-Smtp-Source: AMsMyM73FqWCjIDtdC/5PWeE1u7giRq6V2DVFyzwLQgxnonv6Xsm0mglkylWBFxYWqkVrghHIZ1AY15f9GjowvhLLck= X-Received: by 2002:a81:73d6:0:b0:348:a7b7:10e6 with SMTP id o205-20020a8173d6000000b00348a7b710e6mr17920272ywc.61.1663658185123; Tue, 20 Sep 2022 00:16:25 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::112c; envelope-from=whatson@gmail.com; helo=mail-yw1-x112c.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, 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-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:10373 Archived-At: Hello Guilers! I have some buggy code which fails to compile. While printing the backtrac= e of this compilation error, another error occurs and Guile reports "Exception t= hrown while printing backtrace". To reproduce the error: $ git clone https://gitlab.com/flatwhatson/guile-prescheme.git $ cd guile-prescheme $ git checkout d793730895aaeb4ee203f062ab3864af8fd1d5fd $ guild compile -L . ps-compiler/prescheme/flatten.scm <...snip...> In ice-9/eval.scm: 626:19 7 (_ #) 293:34 6 (_ #(#(#) =E2=80=A6)) 293:34 5 (_ #(#(#) =E2=80=A6)) 214:21 4 (_ #(#(#) =E2=80=A6)) 217:50 3 (lp (# =E2=80=A6)) 217:33 2 (lp (# =E2=80=A6)) Exception thrown while printing backtrace: In procedure frame-local-ref: Argument 2 out of range: 1 ice-9/boot-9.scm:1685:16: In procedure raise-exception: Wrong type to apply: # To investigate further, I've run the compile script from the repl and dug a= round for the responsible frame: > ,use (scripts compile) > (compile "-L" "." "ps-compiler/prescheme/flatten.scm") ;; fails, enters debugger [1]> ,bt ;; fails to print backtrace [1]> ,m (system vm frame) [1]> ,use (system repl common) (system repl debug) (srfi srfi-43) [1]> (debug-frames (repl-debug (car (fluid-ref *repl-stack*)))) ;; $1 is a vector of frame objects [1]> (define (dump-frame i f) (format #t "~a: ~a\n" i f) (frame-arguments= f)) [1]> (vector-for-each dump-frame $1) ;; fails on frame index 2 [2]> (define (dump-binding b) (format #t "~a\n" b)) [2]> (frame-num-locals (vector-ref $1 2)) ;; problem frame has 1 local slot [2]> (for-each dump-binding (frame-bindings (vector-ref $1 2))) #< frame: # idx: 0 name: closure slot: 0 = ... #< frame: # idx: 1 name: args slot: 1 ... [2]> (frame-num-locals (vector-ref $1 3)) ;; parent frame has 2 local slots [2]> (for-each dump-binding (frame-bindings (vector-ref $1 3))) #< frame: # idx: 0 name: closure slot: 0 = ... #< frame: # idx: 1 name: args slot: 1 ... >From this, it looks like there's a broken frame which has 2 bindings, but o= nly 1 local slot, leading to the "out of range" error while printing the backtrac= e. Curiously, its parent frame has the same 2 bindings, and 2 local slots as expected. Any ideas what is happening here? Cheers, Andrew