From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: David Pirotte Newsgroups: gmane.lisp.guile.bugs Subject: bug#37066: Using GOOPS #:allocation #:virtual slot option causes stack overflow Date: Sun, 18 Aug 2019 05:08:53 -0300 Message-ID: <20190818050853.17b31311@capac> References: <20190818004223.22acd911@kompiuter> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/AcATnYB.ec0Q/bi1vM+3ev8"; protocol="application/pgp-signature"; micalg=pgp-sha512 Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="38506"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 37066@debbugs.gnu.org To: Jan Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Aug 18 10:10:12 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 1hzGGR-0009v7-CO for guile-bugs@m.gmane.org; Sun, 18 Aug 2019 10:10:11 +0200 Original-Received: from localhost ([::1]:39690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzGGP-0004xm-U8 for guile-bugs@m.gmane.org; Sun, 18 Aug 2019 04:10:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46812) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1hzGGJ-0004xf-Co for bug-guile@gnu.org; Sun, 18 Aug 2019 04:10:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hzGGI-0003LI-Ap for bug-guile@gnu.org; Sun, 18 Aug 2019 04:10:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hzGGI-0003L9-6w for bug-guile@gnu.org; Sun, 18 Aug 2019 04:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hzGGI-0008WS-07 for bug-guile@gnu.org; Sun, 18 Aug 2019 04:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: David Pirotte Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 18 Aug 2019 08:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37066 X-GNU-PR-Package: guile Original-Received: via spool by 37066-submit@debbugs.gnu.org id=B37066.156611574332678 (code B ref 37066); Sun, 18 Aug 2019 08:10:01 +0000 Original-Received: (at 37066) by debbugs.gnu.org; 18 Aug 2019 08:09:03 +0000 Original-Received: from localhost ([127.0.0.1]:57309 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hzGFL-0008V0-1X for submit@debbugs.gnu.org; Sun, 18 Aug 2019 04:09:03 -0400 Original-Received: from maximusconfessor.all2all.org ([79.99.200.102]:35644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hzGFJ-0008UY-BH for 37066@debbugs.gnu.org; Sun, 18 Aug 2019 04:09:01 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by maximusconfessor.all2all.org (Postfix) with ESMTP id 14FC01BE00A7; Sun, 18 Aug 2019 10:09:00 +0200 (CEST) Original-Received: from maximusconfessor.all2all.org ([127.0.0.1]) by localhost (maximusconfessor.all2all.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TfvDXsSQ4Y1G; Sun, 18 Aug 2019 10:09:00 +0200 (CEST) Original-Received: from capac (unknown [179.210.16.67]) by maximusconfessor.all2all.org (Postfix) with ESMTPSA id 62F461BE009E; Sun, 18 Aug 2019 10:08:59 +0200 (CEST) In-Reply-To: <20190818004223.22acd911@kompiuter> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) 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:9416 Archived-At: --Sig_/AcATnYB.ec0Q/bi1vM+3ev8 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hello Jan, > 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: =20 > allocate_stack failed: Can't allocate memory > Warning: Unwind-only `stack-overflow' exception; skipping pre-unwind > handler. > ... This is not goops bug. The problem occurs because you try to set the value of the virtual slot, something you should never do. Here is a slightly corrected version of your code: (define-module (temperature) #:use-module (oop goops) #:export ( kelvin celsius)) (define-class () (k #:accessor kelvin #:init-keyword #:k #:init-value 0) (c #:accessor celsius #:init-keyword #:c #:allocation #:virtual #:slot-ref (lambda (o) (- (kelvin o) 273.15)) #:slot-set! (lambda (o c) (set! (kelvin o) (+ 273.15 c))))) Then, in a repl: scheme@(guile-user)> (add-to-load-path "/your/temperature/module/path") scheme@(guile-user)> ,use (oop goops) scheme@(guile-user)> ,use (oop goops describe) scheme@(guile-user)> ,use (temperature) ;;; note: source file ... newer than compiled ... ;;; ... scheme@(guile-user)> (make ) $2 =3D #< 5604c4614200> scheme@(guile-user)> (describe $2) #< 5604c4614200> is an instance of class Slots are:=20 k =3D 0 c =3D -273.15 scheme@(guile-user)> (set! (celsius $2) 0) $3 =3D 273.15 scheme@(guile-user)> (describe $2) #< 5604c4614200> is an instance of class Slots are:=20 k =3D 273.15 c =3D 0.0 > ... it also throws a different error ... I didn't look into this manual example code yet, I wanted to get back to your own example first ... David --Sig_/AcATnYB.ec0Q/bi1vM+3ev8 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEhCJlRZtBM3furJHe83T9k6MFetcFAl1ZB5UACgkQ83T9k6MF etcuPQf/bMLGdfjNr8IZdCmBYcAVotYkzpUthWi9RDNJM2SOMHa59Uk41u+3Du+G ZEzol20IyvWlr1QeC16PiTi3QJIX4g2w/TdHXU8kO4p4qsxSh4xauKAE0TznrnPy E/hDjwVnNRkee7uaK2GocPOWuY6UZ7T8yFeIawlYSzeG/FoK+LiGJD7JNDoG/8a+ JxLR5+onscwUuCVybvw8gMi/UnDP+L6JQ9wDk3HiwnO9ZMnx1z8LdhEJDZtfdolg 4jFH+1+Q72dNC1gMtVjoO4pRjbi5tSw4ZtUJJw3p78Wvk5OreUbBDNqI2nl/N8LV 27DRmEOfF7DCgsEIDvnsLv/eYLBNZw== =WaA4 -----END PGP SIGNATURE----- --Sig_/AcATnYB.ec0Q/bi1vM+3ev8--