unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: 43845@debbugs.gnu.org
Subject: bug#43845: toplevel definition in module: another compiler optimization bug
Date: Wed, 07 Oct 2020 14:08:15 +0200	[thread overview]
Message-ID: <878scifdcg.fsf@gnu.org> (raw)

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

Hi!

This morning I found another bug while porting Mes to Guile-3.  It looks
similar to #43831; compilation with -O2 shows wrong behaviour.

Also, this works on Guile-2.2.

To reproduce:

--8<---------------cut here---------------start------------->8---
14:02:54 janneke@dundal:~/tmp/bug2 [env]
$ guile --no-auto-compile -L . script.scm 
dumping0: foo
14:03:06 janneke@dundal:~/tmp/bug2 [env]
$ guild compile -O1 -o mescc.go mescc.scm
wrote `mescc.go'
14:03:33 janneke@dundal:~/tmp/bug2 [env]
$ guile --no-auto-compile -L . -C . script.scm 
dumping0: foo
14:03:42 janneke@dundal:~/tmp/bug2 [env]
$ guild compile -O2 -o mescc.go mescc.scm
wrote `mescc.go'
14:03:49 janneke@dundal:~/tmp/bug2 [env]
$ guile --no-auto-compile -L . -C . script.scm 
dumping0: foo
Backtrace:
           1 (primitive-load "/home/janneke/tmp/bug2/script.scm")
In mescc.scm:
     27:4  0 (with-output-to-file _ #<procedure 7f5effc15388 at mescc.scm:35:6 _>)

mescc.scm:27:4: In procedure with-output-to-file:
Throw to key `looping' with args `()'.
[1]14:03:52 janneke@dundal:~/tmp/bug2 [env]
$
--8<---------------cut here---------------end--------------->8---

Greetings,
Janneke


[-- Attachment #2: script.scm --]
[-- Type: application/octet-stream, Size: 853 bytes --]

;;; GNU Mes --- Maxwell Equations of Software
;;; Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Mes.
;;;
;;; GNU Mes is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Mes is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Mes.  If not, see <http://www.gnu.org/licenses/>.

(use-modules (mescc))
(mescc:compile)

[-- Attachment #3: mescc.scm --]
[-- Type: application/octet-stream, Size: 1312 bytes --]

;;; GNU Mes --- Maxwell Equations of Software
;;; Copyright © 2016,2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;;
;;; This file is part of GNU Mes.
;;;
;;; GNU Mes is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Mes is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Mes.  If not, see <http://www.gnu.org/licenses/>.

(define-module (mescc)
  #:export (mescc:compile))

(define seen? #f) ; For frienldier debugging

(define GUILE-with-output-to-file with-output-to-file)
(define (with-output-to-file file-name thunk)
  (when seen?
    (throw 'looping))
  (set! seen? #t)
  (if (equal? file-name "-") (thunk)
      (GUILE-with-output-to-file file-name thunk)))

(define (mescc:compile)
    (format (current-error-port) "dumping0: ~a\n" "foo")
    (with-output-to-file "foo"
      (lambda _ (display "BOO\n"))))

[-- Attachment #4: 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 12:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=878scifdcg.fsf@gnu.org \
    --to=janneke@gnu.org \
    --cc=43845@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).