* bug#43845: toplevel definition in module: another compiler optimization bug
@ 2020-10-07 12:08 Jan Nieuwenhuizen
0 siblings, 0 replies; only message in thread
From: Jan Nieuwenhuizen @ 2020-10-07 12:08 UTC (permalink / raw)
To: 43845
[-- 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-07 12:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 12:08 bug#43845: toplevel definition in module: another compiler optimization bug Jan Nieuwenhuizen
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).