X-Loop: help-debbugs@HIDDEN Subject: bug#43831: Only when compiled: Wrong number of arguments Resent-From: Jan Nieuwenhuizen <janneke@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-guile@HIDDEN Resent-Date: Tue, 06 Oct 2020 16:40:03 +0000 Resent-Message-ID: <handler.43831.B.16020023836244 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 43831 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 43831 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-guile@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.16020023836244 (code B ref -1); Tue, 06 Oct 2020 16:40:03 +0000 Received: (at submit) by debbugs.gnu.org; 6 Oct 2020 16:39:43 +0000 Received: from localhost ([127.0.0.1]:54015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kPq04-0001ca-D0 for submit <at> debbugs.gnu.org; Tue, 06 Oct 2020 12:39:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:47666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <janneke@HIDDEN>) id 1kPq03-0001cT-4Z for submit <at> debbugs.gnu.org; Tue, 06 Oct 2020 12:39:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <janneke@HIDDEN>) id 1kPq02-0000M3-Mt for bug-guile@HIDDEN; Tue, 06 Oct 2020 12:39:38 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55038) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <janneke@HIDDEN>) id 1kPq01-0000dy-4I; Tue, 06 Oct 2020 12:39:37 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=58166 helo=dundal.janneke.lilypond.org) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from <janneke@HIDDEN>) id 1kPq00-0007YU-OP; Tue, 06 Oct 2020 12:39:36 -0400 From: Jan Nieuwenhuizen <janneke@HIDDEN> Organization: AvatarAcademy.nl X-Url: http://AvatarAcademy.nl Date: Tue, 06 Oct 2020 18:39:35 +0200 Message-ID: <87zh4zqpfc.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) Hi! Running mescc with compiled guile-3.0.4 (guile-3.0-latest on guix master) code gives Wrong number of arguments to #<procedure expr->register (o info)> Using guile-2.2, or running without compiling is fine. To reproduce, do --8<---------------cut here---------------start------------->8--- git clone --branch=3Dwip-guile3 https://git.savannah.gnu.org/git/mes.git guix environment -l guix.scm ./configure SCHEME=3Dguile ./pre-inst-env mescc -c scaffold/hello.c make all-go SCHEME=3Dguile ./pre-inst-env mescc -c scaffold/hello.c --8<---------------cut here---------------end--------------->8--- Note that the first run, before `make all-go' runs fine (see hello.s, hello.o). The second run, running with compiled .go files, gives --8<---------------cut here---------------start------------->8--- Backtrace: In ice-9/boot-9.scm: 1736:10 16 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) In unknown file: 15 (apply-smob/0 #<thunk 7ff3356402a0>) In ice-9/boot-9.scm: 718:2 14 (call-with-prompt _ _ #<procedure default-prompt-handler (k pr= oc)>) In ice-9/eval.scm: 619:8 13 (_ #(#(#<directory (guile-user) 7ff335261f00>))) In mescc/mescc.scm: 120:16 12 (mescc:assemble ((numbered-arch? . #f) (kernel . "linux") (arc= h . "x86_64") (libdir . "/home/?") ?)) In srfi/srfi-1.scm: 586:17 11 (map1 ("scaffold/hello.c")) In ice-9/ports.scm: 445:17 10 (call-with-input-file _ _ #:binary _ #:encoding _ #:guess-enco= ding _) 470:4 9 (_ _) In mescc/compile.scm: 61:14 8 (c99-ast->info _ _ #:verbose? _) In srfi/srfi-1.scm: 460:18 7 (fold #<procedure ast->info (o info)> _ _) In mescc/compile.scm: 2652:17 6 (fctn-defn->info _ #<<info> types: (("wchar_t" . #<<type> type= : signed size: 4 description: #f>) ?>) 1901:2 5 (ast->info _ #<<info> types: (("wchar_t" . #<<type> type: sign= ed size: 4 description: #f>) ("uid_?>) In srfi/srfi-1.scm: 460:18 4 (fold #<procedure ast->info (o info)> #<<info> types: (("wchar= _t" . #<<type> type: signed size: ?> ?) In mescc/compile.scm: 1719:24 3 (ast->info _ #<<info> types: (("wchar_t" . #<<type> type: sign= ed size: 4 description: #f>) ("uid_?>) 1020:30 2 (expr->register _ _) In srfi/srfi-1.scm: 501:18 1 (fold-right #<procedure expr->register (o info)> _ _ . _) In mescc/compile.scm: 882:0 0 (expr->register _ _) mescc/compile.scm:882:0: In procedure expr->register: Wrong number of arguments to #<procedure expr->register (o info)> --8<---------------cut here---------------end--------------->8--- I'm aware that this isn't exactly a "minimal reprocucing example"...however I've no idea to get there. I tried this patch: --8<---------------cut here---------------start------------->8--- diff --git a/module/mescc/compile.scm b/module/mescc/compile.scm index 579de2ceb..213909552 100644 --- a/module/mescc/compile.scm +++ b/module/mescc/compile.scm @@ -879,7 +879,14 @@ ((4) 'r-long-mem= -add)) n)))))) (free-register info)))) =20 -(define (expr->register o info) +(define (expr->register o . rest) + (when (null? rest) + (throw 'expr-register "rest is null for" o)) + (when (> (length rest) 1) + (throw 'expr-register "rest length for:" o (length rest))) + (expr->register- o (car rest))) + +(define (expr->register- o info) (let* ((locals (.locals info)) (text (.text info)) (globals (.globals info)) --8<---------------cut here---------------end--------------->8--- to armor expr->register calls and flag an error, which gives a very similar, and thus even more puzzling backtrace: --8<---------------cut here---------------start------------->8--- [..] In mescc/compile.scm: 887:2 3 (ast->info _ _) 1027:30 2 (expr->register- _ _) In srfi/srfi-1.scm: 501:18 1 (fold-right #<procedure expr->register- (o info)> _ _ . _) In mescc/compile.scm: 889:0 0 (expr->register- _ _) --8<---------------cut here---------------end--------------->8--- because, the new expr->register- has only one call location which is fine. Ideas? Greetings, Janneke --=20 Jan Nieuwenhuizen <janneke@HIDDEN> | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Jan Nieuwenhuizen <janneke@HIDDEN> Subject: bug#43831: Acknowledgement (Only when compiled: Wrong number of arguments) Message-ID: <handler.43831.B.16020023836244.ack <at> debbugs.gnu.org> References: <87zh4zqpfc.fsf@HIDDEN> X-Gnu-PR-Message: ack 43831 X-Gnu-PR-Package: guile Reply-To: 43831 <at> debbugs.gnu.org Date: Tue, 06 Oct 2020 16:40:03 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-guile@HIDDEN If you wish to submit further information on this problem, please send it to 43831 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 43831: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D43831 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#43831: Only when compiled: Wrong number of arguments Resent-From: Jan Nieuwenhuizen <janneke@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-guile@HIDDEN Resent-Date: Wed, 07 Oct 2020 08:31:01 +0000 Resent-Message-ID: <handler.43831.B43831.160205941924840 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 43831 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 43831 <at> debbugs.gnu.org Received: via spool by 43831-submit <at> debbugs.gnu.org id=B43831.160205941924840 (code B ref 43831); Wed, 07 Oct 2020 08:31:01 +0000 Received: (at 43831) by debbugs.gnu.org; 7 Oct 2020 08:30:19 +0000 Received: from localhost ([127.0.0.1]:55160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kQ4q3-0006S5-3u for submit <at> debbugs.gnu.org; Wed, 07 Oct 2020 04:30:19 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <janneke@HIDDEN>) id 1kQ4q1-0006La-Nw for 43831 <at> debbugs.gnu.org; Wed, 07 Oct 2020 04:30:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:41750) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <janneke@HIDDEN>) id 1kQ4pv-0000we-Kf; Wed, 07 Oct 2020 04:30:11 -0400 Received: from [2001:980:1b4f:1:42d2:832d:bb59:862] (port=41698 helo=dundal.janneke.lilypond.org) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from <janneke@HIDDEN>) id 1kQ4pu-0006iM-Nx; Wed, 07 Oct 2020 04:30:11 -0400 From: Jan Nieuwenhuizen <janneke@HIDDEN> Organization: AvatarAcademy.nl References: <87zh4zqpfc.fsf@HIDDEN> X-Url: http://AvatarAcademy.nl Date: Wed, 07 Oct 2020 10:30:08 +0200 In-Reply-To: <87zh4zqpfc.fsf@HIDDEN> (Jan Nieuwenhuizen's message of "Tue, 06 Oct 2020 18:39:35 +0200") Message-ID: <87d01uh20f.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Jan Nieuwenhuizen writes: Hello again, > Running mescc with compiled guile-3.0.4 (guile-3.0-latest on guix > master) code gives > > Wrong number of arguments to #<procedure expr->register (o info)> > > Using guile-2.2, or running without compiling is fine. > > To reproduce, do [..] > I'm aware that this isn't exactly a "minimal reprocucing > example"...however I've no idea to get there. I found a way to bisect it into something much smaller; see attached. To reproduce, do: --8<---------------cut here---------------start------------->8--- $ guix environment --ad-hoc guile@HIDDEN 10:27:13 janneke@dundal:~/tmp/bug [env] $ guile --no-auto-compile -C . -e '(wrong-number-of-arguments)' wrong-number-of-arguments.scm Hello MesCC 10:27:18 janneke@dundal:~/tmp/bug [env] $ guild compile -o wrong-number-of-arguments.go wrong-number-of-arguments.scm ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /gnu/store/yxwq48xmimjsy2b6s6ga8mcfs47af936-profile/bin/guild ;;; compiled /home/janneke/.cache/guile/ccache/3.0-LE-8-4.3/gnu/store/ah16zr8mmfkqy23rr7jy5a842ca1q9h1-guile-3.0.4/bin/guild.go wrote `wrong-number-of-arguments.go' 10:27:28 janneke@dundal:~/tmp/bug [env] $ guile -C . -e '(wrong-number-of-arguments)' wrong-number-of-arguments.scm ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/janneke/tmp/bug/wrong-number-of-arguments.scm ;;; compiled /home/janneke/.cache/guile/ccache/3.0-LE-8-4.3/home/janneke/tmp/bug/wrong-number-of-arguments.scm.go Hello MesCC Backtrace: In ice-9/boot-9.scm: 1736:10 5 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _) In unknown file: 4 (apply-smob/0 #<thunk 7ffb62d6b4a0>) In ice-9/boot-9.scm: 718:2 3 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>) In ice-9/eval.scm: 619:8 2 (_ #(#(#<directory (guile-user) 7ffb629a6f00>))) In srfi/srfi-1.scm: 501:18 1 (fold-right #<procedure expr->register (o info)> _ _ . _) In /home/janneke/tmp/bug/wrong-number-of-arguments.scm: 24:0 0 (expr->register _ _) /home/janneke/tmp/bug/wrong-number-of-arguments.scm:24:0: In procedure expr->register: Wrong number of arguments to #<procedure expr->register (o info)> [1]10:27:41 janneke@dundal:~/tmp/bug [env] $ --8<---------------cut here---------------end--------------->8--- Greetings, Janneke --=-=-= Content-Type: application/octet-stream Content-Disposition: attachment; filename=wrong-number-of-arguments.scm Content-Transfer-Encoding: base64 KGRlZmluZS1tb2R1bGUgKHdyb25nLW51bWJlci1vZi1hcmd1bWVudHMpCiAgIzp1c2UtbW9kdWxl IChzcmZpIHNyZmktMSkKICAjOnVzZS1tb2R1bGUgKHNyZmkgc3JmaS05KQogICM6dXNlLW1vZHVs ZSAoc3JmaSBzcmZpLTkgZ251KQogICM6dXNlLW1vZHVsZSAoc3lzdGVtIGJhc2UgcG1hdGNoKQog ICM6ZXhwb3J0IChtYWluKSkKCihkZWZpbmUtaW1tdXRhYmxlLXJlY29yZC10eXBlIDxpbmZvPgog IChtYWtlLTxpbmZvPiB0eXBlcykKICBpbmZvPwogICh0eXBlcyAudHlwZXMpKQoKKGRlZmluZSAo ZXhwci0+YXJnIG8gaSBpbmZvKQogIChwbWF0Y2ggbwogICAgKF8KICAgICAoZXhwci0+cmVnaXN0 ZXIwIG8gaW5mbykpKSkKCjs7IHJlcGVhdGluZyB0aGUgZXhwci0+YXJnIGRlZmluaXRpb24gbWFr ZXMgdGhlIGJ1ZyBnbyBhd2F5Ogo7OyAoZGVmaW5lIChleHByLT5hcmcgbyBpIGluZm8pCjs7ICAg KHBtYXRjaCBvCjs7ICAgICAoXwo7OyAgICAgIChleHByLT5yZWdpc3RlcjAgbyBpbmZvKSkpKQoK KGRlZmluZSAoZXhwci0+cmVnaXN0ZXIgbyBpbmZvKQogIChwbWF0Y2ggbwogICAgKChleHByLWxp c3QgLiAsZXhwci1saXN0KQogICAgIChmb2xkLXJpZ2h0IGV4cHItPmFyZyBpbmZvIGV4cHItbGlz dCAocmV2ZXJzZSAoaW90YSAobGVuZ3RoIGV4cHItbGlzdCkpKSkpKSkKCihkZWZpbmUgKGV4cHIt PnJlZ2lzdGVyMCBvIGluZm8pCiAgKGV4cHItPnJlZ2lzdGVyIG8gaW5mbykpCgooZGVmaW5lIGhl bGxvLWV4cHItbGlzdAogICcoZXhwci1saXN0IChwLWV4cHIgKHN0cmluZyAiSGVsbG8sIE1lc2Nj IVxuIikpKSkKCihkZWZpbmUgKG1haW4gLiBhcmdzKQogIChmb3JtYXQgI3QgIkhlbGxvIE1lc0ND XG4iKQogIChleHByLT5yZWdpc3RlciBoZWxsby1leHByLWxpc3QgKG1ha2UtPGluZm8+ICcoKSkp KQo= --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 Jan Nieuwenhuizen <janneke@HIDDEN> | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com --=-=-=--
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.