From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jan Newsgroups: gmane.lisp.guile.bugs Subject: bug#37066: Using GOOPS #:allocation #:virtual slot option causes stack overflow Date: Sun, 18 Aug 2019 00:42:23 +0200 Message-ID: <20190818004223.22acd911@kompiuter> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="32308"; mail-complaints-to="usenet@blaine.gmane.org" To: 37066@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Aug 18 00:44:11 2019 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hz7Qg-0008Ig-Eg for guile-bugs@m.gmane.org; Sun, 18 Aug 2019 00:44:10 +0200 Original-Received: from localhost ([::1]:38410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hz7Qf-0003Sz-Al for guile-bugs@m.gmane.org; Sat, 17 Aug 2019 18:44:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49288) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hz7Qa-0003St-5Y for bug-guile@gnu.org; Sat, 17 Aug 2019 18:44:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hz7QY-0002bK-S7 for bug-guile@gnu.org; Sat, 17 Aug 2019 18:44:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48258) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hz7QY-0002bD-P8 for bug-guile@gnu.org; Sat, 17 Aug 2019 18:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hz7QY-0001yw-Lf for bug-guile@gnu.org; Sat, 17 Aug 2019 18:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jan Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 17 Aug 2019 22:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37066 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15660817877538 (code B ref -1); Sat, 17 Aug 2019 22:44:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Aug 2019 22:43:07 +0000 Original-Received: from localhost ([127.0.0.1]:57079 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hz7Pe-0001xW-So for submit@debbugs.gnu.org; Sat, 17 Aug 2019 18:43:07 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:51740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hz7Pc-0001xO-KG for submit@debbugs.gnu.org; Sat, 17 Aug 2019 18:43:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49169) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hz7Pa-0003Lw-SX for bug-guile@gnu.org; Sat, 17 Aug 2019 18:43:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hz7PZ-0002BX-Fm for bug-guile@gnu.org; Sat, 17 Aug 2019 18:43:02 -0400 Original-Received: from smtpo.poczta.interia.pl ([217.74.65.157]:41880) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hz7PY-00027v-Qw for bug-guile@gnu.org; Sat, 17 Aug 2019 18:43:01 -0400 X-Interia-R: Interia X-Interia-R-IP: 89.64.25.42 X-Interia-R-Helo: Original-Received: from kompiuter (89-64-25-42.dynamic.chello.pl [89.64.25.42]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by poczta.interia.pl (INTERIA.PL) with ESMTPSA for ; Sun, 18 Aug 2019 00:42:50 +0200 (CEST) X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) X-Interia-Antivirus: OK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=interia.pl; s=biztos; t=1566081771; bh=Ev6vxOozQmRNlY1fv33tbhaqmRAdTf4VlmLv7Oj0gcc=; h=X-Interia-R:X-Interia-R-IP:X-Interia-R-Helo:Date:From:To:Subject: Message-ID:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding:X-Interia-Antivirus; b=sFMUW8SQhxjvWWknSTYFzK0wbimJNvqsi4O0LdbVmMnhRGj9N06bQv4L2oGB4sJnY UC4hwjhVGemzoGQWsJ00a1qShvT/5uibu16AZB2W+m2kAjVnm8ktcylihp849XIvYl hNJGwpOO5uPdPlzuVeKA3Rp3I4k/tCWBzeZMH8kc= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9415 Archived-At: Hi everyone. I've written the program attached below and it hangs at writing=20 "after changing (K): ", computer freezes for a moment and then Guile throws the following message: allocate_stack failed: Can't allocate memory Warning: Unwind-only `stack-overflow' exception; skipping pre-unwind handler. allocate_stack failed: Can't allocate memory Warning: Unwind-only `stack-overflow' exception; skipping pre-unwind handler. Guile version: 2.9.3 OS: Devuan ASCII GNU/Linux Architecture: x86_64 Code: (define-class () (k #:init-value 0 #:init-keyword #:k #:accessor kelvin) (c #:accessor celsius #:init-keyword #:c #:allocation #:virtual #:slot-ref (lambda (o) (let ((k (slot-ref o 'k))) (- k 273.15))) #:slot-set! (lambda (o c) (slot-set! o 'c c) (slot-set! o 'k (+ 273.15 c))))) (define (test-virtual-slots) (let ((temp1 (make #:k 0))) (display "Absolute zero(K): ") (display (kelvin temp1)) (newline) (display "Absolute zero(C): ") (display (celsius temp1)) (newline) (display "After changing (K): ") (slot-set! temp1 'c 0) (display (kelvin temp1)))) (test-virtual-slots) I couldn't find any mistake, because I'm a new Guile user, so please tell me if I'm doing something wrong. Using an example from the manual (8.5 Illustrating Slot Description) didn't help, because it also throws a different error, not sure if I hadn't copied everything or if there's something fundamentally wrong in GOOPS. The code of the example: (define-class () ;; True slots use rectangular coordinates (r #:init-value 0 #:accessor real-part #:init-keyword #:r) (i #:init-value 0 #:accessor imag-part #:init-keyword #:i) ;; Virtual slots access do the conversion (m #:accessor magnitude #:init-keyword #:magn #:allocation #:virtual #:slot-ref (lambda (o) (let ((r (slot-ref o =E2=80=99r)) (i (slot-ref o =E2=80= =99i))) (sqrt (+ (* r r) (* i i))))) #:slot-set! (lambda (o m) (let ((a (slot-ref o =E2=80=99a))) (slot-set! o =E2=80=99r (* m (cos a))) (slot-set! o =E2=80=99i (* m (sin a)))))) (a #:accessor angle #:init-keyword #:angle #:allocation #:virtual #:slot-ref (lambda (o) (atan (slot-ref o =E2=80=99i) (slot-ref o =E2=80=99r))) #:slot-set! (lambda(o a) (let ((m (slot-ref o =E2=80=99m))) (slot-set! o =E2=80=99r (* m (cos a))) (slot-set! o =E2=80=99i (* m (sin a))))))) (define c (make #:r 12 #:i 20)) (slot-set! c =E2=80=99a 3) (display "Real part: ") (display (real-part c)) (newline) (display "Angle: ") (display (angle c)) (newline) (slot-set! c =E2=80=99i 10) (set! (real-part c) 1) (describe c) The error: ;;; /home/user/Projects/guile/./goops-bug.scm:44:47: warning: possibly unbound variable `#{\x2019;i}#' ;;; /home/user/Projects/guile/./goops-bug.scm:47:28: warning: possibly unbound variable `#{\x2019;a}#' ;;; /home/user/Projects/guile/./goops-bug.scm:48:21: warning: possibly unbound variable `#{\x2019;r}#' ;;; /home/user/Projects/guile/./goops-bug.scm:49:21: warning: possibly unbound variable `#{\x2019;i}#' ;;; /home/user/Projects/guile/./goops-bug.scm:53:24: warning: possibly unbound variable `#{\x2019;i}#' ;;; /home/user/Projects/guile/./goops-bug.scm:53:40: warning: possibly unbound variable `#{\x2019;r}#' ;;; /home/user/Projects/guile/./goops-bug.scm:55:28: warning: possibly unbound variable `#{\x2019;m}#' ;;; /home/user/Projects/guile/./goops-bug.scm:56:21: warning: possibly unbound variable `#{\x2019;r}#' ;;; /home/user/Projects/guile/./goops-bug.scm:57:21: warning: possibly unbound variable `#{\x2019;i}#' ;;; /home/user/Projects/guile/./goops-bug.scm:60:0: warning: possibly unbound variable `#{\x2019;a}#' ;;; /home/user/Projects/guile/./goops-bug.scm:67:0: warning: possibly unbound variable `#{\x2019;i}#' ;;; compiled /home/user/.cache/guile/ccache/3.0-LE-8-4.1/home/user/Projects/gui= le/goops-bug.scm.go Backtrace: 5 (apply-smob/1 #) In ice-9/boot-9.scm: 702:2 4 (call-with-prompt _ _ #) In ice-9/eval.scm: 619:8 3 (_ #(#(#))) In ice-9/boot-9.scm: 2296:4 2 (save-module-excursion _) 3816:12 1 (_) In /home/user/Projects/guile/./goops-bug.scm: 69:0 0 (_) /home/user/Projects/guile/./goops-bug.scm:69:0: Unbound variable: #{\x2019;a}# The line 69 is the last line of the program.