GNU bug report logs - #19246
bindings: void return function *can* trigger a segfault

Previous Next

Package: guile;

Reported by: Amirouche Boubekki <amirouche.boubekki <at> gmail.com>

Date: Mon, 1 Dec 2014 20:20:01 UTC

Severity: normal

Tags: notabug

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


Message #10 received at 19246-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Amirouche Boubekki <amirouche.boubekki <at> gmail.com>
Cc: 19246-done <at> debbugs.gnu.org
Subject: Re: bug#19246: bindings: void return function *can* trigger a segfault
Date: Mon, 01 Dec 2014 22:50:38 +0100
Hi,

Amirouche Boubekki <amirouche.boubekki <at> gmail.com> skribis:

> void process(SCM integer, SCM other) {
>   int a = scm_to_int(integer);
>   int b = scm_to_int(other);
>   int i, c = 0;
>
>   for (i = 0; i<1000; i++) {
>     c = c + a + b;
>   }
> }
>
>
> void init () {
>   scm_c_define_gsubr("process", 2, 0, 0, process);
> }

Functions exposed to Scheme must always return ‘SCM’.

So ‘process’ above must be changed to return ‘SCM’, possibly the
SCM_UNSPECIFIED value since it’s a side-effecting function.

Thanks,
Ludo’.




This bug report was last modified 10 years and 235 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.