unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Sergei Trofimovich <slyfox@gentoo.org>
To: 29162@debbugs.gnu.org
Cc: Sergei Trofimovich <slyfox@gentoo.org>
Subject: bug#29162: [PATCH] fix scm_make_foreign_object_n
Date: Sun,  5 Nov 2017 22:15:10 +0000	[thread overview]
Message-ID: <20171105221510.12760-1-slyfox@gentoo.org> (raw)

Noticed the error when ran test suite on ia64
but failure is not specific to t. x86_64 is as broken.

test-foreign-object-c fails as:

```
Backtrace:
           0 (apply-smob/1 #<catch-closure 556d010a52a0>)

ERROR: In procedure apply-smob/1:
ERROR: In procedure make-foreign-object: Value out of range: 2
FAIL: test-foreign-object-c
```

The cause of the failure is wrong check for amount of available
slots prepared by 'scm_make_foreign_object_type'.

The fix is easy: check for amount of slots available.

* libguile/foreign-object.c(scm_make_foreign_object_n): fix slot
  count check in foreign object constructors.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
 libguile/foreign-object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libguile/foreign-object.c b/libguile/foreign-object.c
index 34b9f22ca..8fd2c384c 100644
--- a/libguile/foreign-object.c
+++ b/libguile/foreign-object.c
@@ -108,7 +108,7 @@ scm_make_foreign_object_n (SCM type, size_t n, void *vals[])
 
   SCM_VALIDATE_VTABLE (SCM_ARG1, type);
 
-  if (SCM_VTABLE_SIZE (type) / 2 < n)
+  if (SCM_VTABLE_SIZE (type) < n)
     scm_out_of_range (FUNC_NAME, scm_from_size_t (n));
 
   for (i = 0; i < n; i++)
-- 
2.15.0






             reply	other threads:[~2017-11-05 22:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-05 22:15 Sergei Trofimovich [this message]
2017-11-22 15:12 ` bug#29162: [PATCH] fix scm_make_foreign_object_n Ludovic Courtès
2017-11-22 20:03   ` Sergei Trofimovich
2017-11-22 21:29     ` Ludovic Courtès

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=20171105221510.12760-1-slyfox@gentoo.org \
    --to=slyfox@gentoo.org \
    --cc=29162@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).