unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: 43831@debbugs.gnu.org
Subject: bug#43831: Only when compiled: Wrong number of arguments
Date: Wed, 07 Oct 2020 10:30:08 +0200	[thread overview]
Message-ID: <87d01uh20f.fsf@gnu.org> (raw)
In-Reply-To: <87zh4zqpfc.fsf@gnu.org> (Jan Nieuwenhuizen's message of "Tue, 06 Oct 2020 18:39:35 +0200")

[-- Attachment #1: Type: text/plain, Size: 2484 bytes --]

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@3.0.4
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


[-- Attachment #2: wrong-number-of-arguments.scm --]
[-- Type: application/octet-stream, Size: 914 bytes --]

(define-module (wrong-number-of-arguments)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-9)
  #:use-module (srfi srfi-9 gnu)
  #:use-module (system base pmatch)
  #:export (main))

(define-immutable-record-type <info>
  (make-<info> types)
  info?
  (types .types))

(define (expr->arg o i info)
  (pmatch o
    (_
     (expr->register0 o info))))

;; repeating the expr->arg definition makes the bug go away:
;; (define (expr->arg o i info)
;;   (pmatch o
;;     (_
;;      (expr->register0 o info))))

(define (expr->register o info)
  (pmatch o
    ((expr-list . ,expr-list)
     (fold-right expr->arg info expr-list (reverse (iota (length expr-list)))))))

(define (expr->register0 o info)
  (expr->register o info))

(define hello-expr-list
  '(expr-list (p-expr (string "Hello, Mescc!\n"))))

(define (main . args)
  (format #t "Hello MesCC\n")
  (expr->register hello-expr-list (make-<info> '())))

[-- Attachment #3: Type: text/plain, Size: 152 bytes --]


-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com

      reply	other threads:[~2020-10-07  8:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 16:39 bug#43831: Only when compiled: Wrong number of arguments Jan Nieuwenhuizen
2020-10-07  8:30 ` Jan Nieuwenhuizen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d01uh20f.fsf@gnu.org \
    --to=janneke@gnu.org \
    --cc=43831@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).