From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jan Nieuwenhuizen Newsgroups: gmane.lisp.guile.bugs Subject: bug#43831: Only when compiled: Wrong number of arguments Date: Tue, 06 Oct 2020 18:39:35 +0200 Organization: AvatarAcademy.nl Message-ID: <87zh4zqpfc.fsf@gnu.org> 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="37971"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) To: 43831@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Tue Oct 06 18:40:09 2020 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 1kPq0W-0009kb-SL for guile-bugs@m.gmane-mx.org; Tue, 06 Oct 2020 18:40:08 +0200 Original-Received: from localhost ([::1]:58914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPq0V-0000OO-Tl for guile-bugs@m.gmane-mx.org; Tue, 06 Oct 2020 12:40:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33404) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPq0R-0000NE-IG for bug-guile@gnu.org; Tue, 06 Oct 2020 12:40:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kPq0R-0000gD-8M for bug-guile@gnu.org; Tue, 06 Oct 2020 12:40:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kPq0R-0001dk-6J for bug-guile@gnu.org; Tue, 06 Oct 2020 12:40:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jan Nieuwenhuizen Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 06 Oct 2020 16:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43831 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16020023836244 (code B ref -1); Tue, 06 Oct 2020 16:40:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Oct 2020 16:39:43 +0000 Original-Received: from localhost ([127.0.0.1]:54015 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kPq04-0001ca-D0 for submit@debbugs.gnu.org; Tue, 06 Oct 2020 12:39:43 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:47666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kPq03-0001cT-4Z for submit@debbugs.gnu.org; Tue, 06 Oct 2020 12:39:39 -0400 Original-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 ) id 1kPq02-0000M3-Mt for bug-guile@gnu.org; Tue, 06 Oct 2020 12:39:38 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55038) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPq01-0000dy-4I; Tue, 06 Oct 2020 12:39:37 -0400 Original-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 ) id 1kPq00-0007YU-OP; Tue, 06 Oct 2020 12:39:36 -0400 X-Url: http://AvatarAcademy.nl 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:9896 Archived-At: Hi! Running mescc with compiled guile-3.0.4 (guile-3.0-latest on guix master) code gives Wrong number of arguments to #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 #) In ice-9/boot-9.scm: 718:2 14 (call-with-prompt _ _ #) In ice-9/eval.scm: 619:8 13 (_ #(#(#))) 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 #info (o info)> _ _) In mescc/compile.scm: 2652:17 6 (fctn-defn->info _ #< types: (("wchar_t" . #< type= : signed size: 4 description: #f>) ?>) 1901:2 5 (ast->info _ #< types: (("wchar_t" . #< type: sign= ed size: 4 description: #f>) ("uid_?>) In srfi/srfi-1.scm: 460:18 4 (fold #info (o info)> #< types: (("wchar= _t" . #< type: signed size: ?> ?) In mescc/compile.scm: 1719:24 3 (ast->info _ #< types: (("wchar_t" . #< type: sign= ed size: 4 description: #f>) ("uid_?>) 1020:30 2 (expr->register _ _) In srfi/srfi-1.scm: 501:18 1 (fold-right #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 #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 #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 | GNU LilyPond http://lilypond.org Freelance IT http://JoyofSource.com | Avatar=C2=AE http://AvatarAcademy.com