GNU bug report logs - #10015
Guile-2.0.3: test-ffi fails

Previous Next

Package: guile;

Reported by: Hans Aberg <haberg-1 <at> telia.com>

Date: Thu, 10 Nov 2011 21:17:01 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10015 in the body.
You can then email your comments to 10015 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#10015; Package guile. (Thu, 10 Nov 2011 21:17:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hans Aberg <haberg-1 <at> telia.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Thu, 10 Nov 2011 21:17:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hans Aberg <haberg-1 <at> telia.com>
To: bug-guile bug <bug-guile <at> gnu.org>
Subject: Guile-2.0.3: test-ffi fails
Date: Thu, 10 Nov 2011 22:16:26 +0100
With guile-2.0.3, OS X 10.7.2, Xcode 4.2, i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1, 'make check' fails on test-ffi. Here, libffi-3.0.9 is used; libffi-3.0.10 does not compile with the same setup.

Hans






Information forwarded to bug-guile <at> gnu.org:
bug#10015; Package guile. (Wed, 16 Nov 2011 19:32:02 GMT) Full text and rfc822 format available.

Message #8 received at 10015 <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Hans Aberg <haberg-1 <at> telia.com>
Cc: 10015 <at> debbugs.gnu.org
Subject: Re: bug#10015: Guile-2.0.3: test-ffi fails
Date: Wed, 16 Nov 2011 20:30:17 +0100
On Thu 10 Nov 2011 22:16, Hans Aberg <haberg-1 <at> telia.com> writes:

> With guile-2.0.3, OS X 10.7.2, Xcode 4.2,
> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1, 'make check' fails on
> test-ffi. Here, libffi-3.0.9 is used; libffi-3.0.10 does not compile
> with the same setup.

How does it fail?  Can you provide a backtrace?

Andy
-- 
http://wingolog.org/




Information forwarded to bug-guile <at> gnu.org:
bug#10015; Package guile. (Wed, 16 Nov 2011 20:18:02 GMT) Full text and rfc822 format available.

Message #11 received at 10015 <at> debbugs.gnu.org (full text, mbox):

From: Hans Aberg <haberg-1 <at> telia.com>
To: Andy Wingo <wingo <at> pobox.com>
Cc: 10015 <at> debbugs.gnu.org
Subject: Re: bug#10015: Guile-2.0.3: test-ffi fails
Date: Wed, 16 Nov 2011 21:16:27 +0100
On 16 Nov 2011, at 20:30, Andy Wingo wrote:

> On Thu 10 Nov 2011 22:16, Hans Aberg <haberg-1 <at> telia.com> writes:
> 
>> With guile-2.0.3, OS X 10.7.2, Xcode 4.2,
>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1, 'make check' fails on
>> test-ffi. Here, libffi-3.0.9 is used; libffi-3.0.10 does not compile
>> with the same setup.
> 
> How does it fail?  Can you provide a backtrace?

If you tell mw how. Have have a later version of Libffi, though, which should perhaps be tried.

Hans






Information forwarded to bug-guile <at> gnu.org:
bug#10015; Package guile. (Wed, 16 Nov 2011 21:48:01 GMT) Full text and rfc822 format available.

Message #14 received at 10015 <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Hans Aberg <haberg-1 <at> telia.com>
Cc: 10015 <at> debbugs.gnu.org
Subject: Re: bug#10015: Guile-2.0.3: test-ffi fails
Date: Wed, 16 Nov 2011 22:46:39 +0100
On Wed 16 Nov 2011 21:16, Hans Aberg <haberg-1 <at> telia.com> writes:

> On 16 Nov 2011, at 20:30, Andy Wingo wrote:
>
>> On Thu 10 Nov 2011 22:16, Hans Aberg <haberg-1 <at> telia.com> writes:
>> 
>>> With guile-2.0.3, OS X 10.7.2, Xcode 4.2,
>>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1, 'make check' fails on
>>> test-ffi. Here, libffi-3.0.9 is used; libffi-3.0.10 does not compile
>>> with the same setup.
>> 
>> How does it fail?  Can you provide a backtrace?
>
> If you tell mw how. Have have a later version of Libffi, though, which
> should perhaps be tried.

$ cd test-suite/standalone
$ builddir=`pwd` ../../meta/gdb-uninstalled-guile
(gdb) run
scheme@(guile-user)> (load "test-ffi")

Then on the error, if it is a segfault or something, GDB will stop.  You
type "thr apply all bt full" and include the results in the reply.

Andy
-- 
http://wingolog.org/




Information forwarded to bug-guile <at> gnu.org:
bug#10015; Package guile. (Thu, 17 Nov 2011 08:32:01 GMT) Full text and rfc822 format available.

Message #17 received at 10015 <at> debbugs.gnu.org (full text, mbox):

From: Hans Aberg <haberg-1 <at> telia.com>
To: Andy Wingo <wingo <at> pobox.com>
Cc: 10015 <at> debbugs.gnu.org
Subject: Re: bug#10015: Guile-2.0.3: test-ffi fails
Date: Thu, 17 Nov 2011 09:30:37 +0100
On 16 Nov 2011, at 22:46, Andy Wingo wrote:

> On Wed 16 Nov 2011 21:16, Hans Aberg <haberg-1 <at> telia.com> writes:
> 
>> On 16 Nov 2011, at 20:30, Andy Wingo wrote:
>> 
>>> On Thu 10 Nov 2011 22:16, Hans Aberg <haberg-1 <at> telia.com> writes:
>>> 
>>>> With guile-2.0.3, OS X 10.7.2, Xcode 4.2,
>>>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1, 'make check' fails on
>>>> test-ffi. Here, libffi-3.0.9 is used; libffi-3.0.10 does not compile
>>>> with the same setup.
>>> 
>>> How does it fail?  Can you provide a backtrace?
>> 
>> If you tell mw how. Have have a later version of Libffi, though, which
>> should perhaps be tried.
> 
> $ cd test-suite/standalone

After rebuilding that, I have
$ pwd
/usr/local/src/guile/guile-2.0.3/test-suite/standalone

> $ builddir=`pwd` ../../meta/gdb-uninstalled-guile

Then this produce a lot of errors 
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .....
warning: Could not find object file "/usr/local/src/gettext-0.18/gettext-tools/intl/.libs/bindtextdom.o" - no debug information available for "../../gettext-runtime/intl/bindtextdom.c".
...
warning: Could not find object file "/usr/local/src/libunistring-0.9.3/lib/.libs/c-ctype.o" - no debug information available for "c-ctype.c".
...
warning: Could not find object file "/Users/haberg/libiconv-1.9.2/lib/.libs/iconv.o" - no debug information available for "./iconv.c".
...
warning: Could not find object file "/Users/haberg/libiconv-1.9.2/lib/.libs/localcharset.o" - no debug information available for "./../libcharset/lib/localcharset.c".
...
warning: Could not find object file "/usr/local/src/libtool-2.4/libltdl/loaders/.libs/libltdl_libltdl_la-preopen.o" - no debug information available for "libltdl/loaders/preopen.c".

I have those libraries installed, but in /usr/local/src/ are just unpacked libraries.

> (gdb) run
> scheme@(guile-user)> (load "test-ffi")

So I do not get that far.

Hans






Information forwarded to bug-guile <at> gnu.org:
bug#10015; Package guile. (Thu, 17 Nov 2011 14:35:02 GMT) Full text and rfc822 format available.

Message #20 received at 10015 <at> debbugs.gnu.org (full text, mbox):

From: Hans Aberg <haberg-1 <at> telia.com>
To: Andy Wingo <wingo <at> pobox.com>
Cc: 10015 <at> debbugs.gnu.org
Subject: Re: bug#10015: Guile-2.0.3: test-ffi fails
Date: Thu, 17 Nov 2011 15:32:53 +0100
On 16 Nov 2011, at 20:30, Andy Wingo wrote:

>> With guile-2.0.3, OS X 10.7.2, Xcode 4.2,
>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1, 'make check' fails on
>> test-ffi. Here, libffi-3.0.9 is used; libffi-3.0.10 does not compile
>> with the same setup.
> 
> How does it fail? 

I redid the check; it looks like:
...
PASS: test-asmobs
bad return from expression `(f-sum -1 2000 -30000 40000000000)': expected 39999971999; got 39999972255
FAIL: test-ffi
...

Hans






Information forwarded to bug-guile <at> gnu.org:
bug#10015; Package guile. (Fri, 18 Nov 2011 06:40:02 GMT) Full text and rfc822 format available.

Message #23 received at 10015 <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Hans Aberg <haberg-1 <at> telia.com>
Cc: 10015 <at> debbugs.gnu.org
Subject: Re: bug#10015: Guile-2.0.3: test-ffi fails
Date: Fri, 18 Nov 2011 07:38:23 +0100
On Thu 17 Nov 2011 15:32, Hans Aberg <haberg-1 <at> telia.com> writes:

> On 16 Nov 2011, at 20:30, Andy Wingo wrote:
>
>>> With guile-2.0.3, OS X 10.7.2, Xcode 4.2,
>>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1, 'make check' fails on
>>> test-ffi. Here, libffi-3.0.9 is used; libffi-3.0.10 does not compile
>>> with the same setup.
>> 
>> How does it fail? 
>
> bad return from expression `(f-sum -1 2000 -30000 40000000000)': expected 39999971999; got 39999972255

Interesting.  This is off by 256.  It seems that the -1 is being
interpreted as an unsigned int8, not a signed int8.  But the bit
patterns are correct.  I think this is either a configuration bug in
Guile, or an llvm bug.

Transcript:

    wingo <at> badger:~/src/guile$ meta/gdb-uninstalled-guile
    GNU gdb (GDB) 7.3-debian
    Copyright (C) 2011 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>...
    Reading symbols from /home/wingo/src/guile/libguile/.libs/lt-guile...done.
    (gdb) r
    Starting program: /home/wingo/src/guile/libguile/.libs/lt-guile 
    [Thread debugging using libthread_db enabled]
    [New Thread 0x7ffff554b700 (LWP 19411)]
    GNU Guile 2.0.3
    Copyright (C) 1995-2011 Free Software Foundation, Inc.

    Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
    This program is free software, and you are welcome to redistribute it
    under certain conditions; type `,show c' for details.

    Enter `,help' for help.
    scheme@(guile-user)> (dynamic-link "./test-suite/standalone/libtest-ffi")
    $1 = #<dynamic-object "./test-suite/standalone/libtest-ffi">
    scheme@(guile-user)> (dynamic-pointer "test_ffi_sum" $1)
    $2 = #<pointer 0x7ffff49cdf20>
    scheme@(guile-user)> (use-modules (system foreign))
    scheme@(guile-user)> (define f-sum (pointer->procedure int64 $2 (list int8 int16 int32 int64)))
    scheme@(guile-user)> (f-sum -1 2000 -30000 40000000000)
    $3 = 39999971999
    scheme@(guile-user)> 
    Program received signal SIGINT, Interrupt.
    0x00007ffff739417d in read () at ../sysdeps/unix/syscall-template.S:82
    82	../sysdeps/unix/syscall-template.S: No such file or directory.
    	in ../sysdeps/unix/syscall-template.S
    (gdb) b test_ffi_sum
    Breakpoint 1 at 0x7ffff49cdf20: file test-ffi-lib.c, line 193.
    (gdb) c
    Continuing.
    (f-sum -1 2000 -30000 40000000000)

    Breakpoint 1, test_ffi_sum (a=-1 '\377', b=2000, c=-30000, d=40000000000) at test-ffi-lib.c:193
    193	  return d + c + b + a;
    (gdb) 

You can see at this breakpoint that we would get the incorrect result
*only* if the type of `a' were actually unsigned char rather than signed
char.  Can you give the output of `grep scm_t_int8 libguile/scmconfig.h'
?

Thanks,

Andy
-- 
http://wingolog.org/




Information forwarded to bug-guile <at> gnu.org:
bug#10015; Package guile. (Fri, 18 Nov 2011 08:48:02 GMT) Full text and rfc822 format available.

Message #26 received at 10015 <at> debbugs.gnu.org (full text, mbox):

From: Hans Aberg <haberg-1 <at> telia.com>
To: Andy Wingo <wingo <at> pobox.com>
Cc: 10015 <at> debbugs.gnu.org
Subject: Re: bug#10015: Guile-2.0.3: test-ffi fails
Date: Fri, 18 Nov 2011 09:46:15 +0100
On 18 Nov 2011, at 07:38, Andy Wingo wrote:

>>>> With guile-2.0.3, OS X 10.7.2, Xcode 4.2,
>>>> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1, 'make check' fails on
>>>> test-ffi. Here, libffi-3.0.9 is used; libffi-3.0.10 does not compile
>>>> with the same setup.
>>> 
>>> How does it fail? 
>> 
>> bad return from expression `(f-sum -1 2000 -30000 40000000000)': expected 39999971999; got 39999972255
> 
> Interesting.  This is off by 256.  It seems that the -1 is being
> interpreted as an unsigned int8, not a signed int8.  But the bit
> patterns are correct.  I think this is either a configuration bug in
> Guile, or an llvm bug.

WHen I try clang, I get an error similar to the one I got with 1.9.15 with llvm.

Hans

$ export CC=clang
$ ./configure
...
$ make V=1
make  all-recursive
Making all in lib
make  all-recursive
make[4]: Nothing to be done for `all-am'.
Making all in meta
make[2]: Nothing to be done for `all'.
Making all in libguile
make  all-am
cat alist.doc arbiters.doc array-handle.doc array-map.doc arrays.doc async.doc backtrace.doc boolean.doc bitvectors.doc bytevectors.doc chars.doc control.doc continuations.doc debug.doc deprecated.doc deprecation.doc dynl.doc dynwind.doc eq.doc error.doc eval.doc evalext.doc expand.doc extensions.doc feature.doc filesys.doc fluids.doc foreign.doc fports.doc gc-malloc.doc gc.doc gettext.doc generalized-arrays.doc generalized-vectors.doc goops.doc gsubr.doc guardians.doc hash.doc hashtab.doc hooks.doc i18n.doc init.doc ioext.doc keywords.doc list.doc load.doc macros.doc mallocs.doc memoize.doc modules.doc numbers.doc objprop.doc options.doc pairs.doc ports.doc print.doc procprop.doc procs.doc promises.doc r6rs-ports.doc random.doc rdelim.doc read.doc root.doc rw.doc scmsigs.doc script.doc simpos.doc smob.doc sort.doc srcprop.doc srfi-1.doc srfi-4.doc srfi-13.doc srfi-14.doc srfi-60.doc stackchk.doc stacks.doc stime.doc strings.doc strorder.doc strports.doc struct.doc symbols.doc threads.doc throw.doc trees.doc uniform.doc values.doc variable.doc vectors.doc version.doc vports.doc weaks.doc dynl.doc posix.doc net_db.doc socket.doc regex-posix.doc | GUILE_AUTO_COMPILE=0 ../meta/uninstalled-env guild snarf-check-and-output-texi          > guile-procedures.texi || { rm guile-procedures.texi; false; }
/bin/sh: line 1: 26068 Broken pipe: 13         cat alist.doc arbiters.doc array-handle.doc array-map.doc arrays.doc async.doc backtrace.doc boolean.doc bitvectors.doc bytevectors.doc chars.doc control.doc continuations.doc debug.doc deprecated.doc deprecation.doc dynl.doc dynwind.doc eq.doc error.doc eval.doc evalext.doc expand.doc extensions.doc feature.doc filesys.doc fluids.doc foreign.doc fports.doc gc-malloc.doc gc.doc gettext.doc generalized-arrays.doc generalized-vectors.doc goops.doc gsubr.doc guardians.doc hash.doc hashtab.doc hooks.doc i18n.doc init.doc ioext.doc keywords.doc list.doc load.doc macros.doc mallocs.doc memoize.doc modules.doc numbers.doc objprop.doc options.doc pairs.doc ports.doc print.doc procprop.doc procs.doc promises.doc r6rs-ports.doc random.doc rdelim.doc read.doc root.doc rw.doc scmsigs.doc script.doc simpos.doc smob.doc sort.doc srcprop.doc srfi-1.doc srfi-4.doc srfi-13.doc srfi-14.doc srfi-60.doc stackchk.doc stacks.doc stime.doc strings.doc strorder.doc strports.doc struct.doc symbols.doc threads.doc throw.doc trees.doc uniform.doc values.doc variable.doc vectors.doc version.doc vports.doc weaks.doc dynl.doc posix.doc net_db.doc socket.doc regex-posix.doc
     26069 Segmentation fault: 11  | GUILE_AUTO_COMPILE=0 ../meta/uninstalled-env guild snarf-check-and-output-texi > guile-procedures.texi
make[3]: *** [guile-procedures.texi] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2






Reply sent to Mark H Weaver <mhw <at> netris.org>:
You have taken responsibility. (Mon, 25 Feb 2013 03:19:02 GMT) Full text and rfc822 format available.

Notification sent to Hans Aberg <haberg-1 <at> telia.com>:
bug acknowledged by developer. (Mon, 25 Feb 2013 03:19:03 GMT) Full text and rfc822 format available.

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

From: Mark H Weaver <mhw <at> netris.org>
To: Hans Aberg <haberg-1 <at> telia.com>
Cc: 10015-done <at> debbugs.gnu.org
Subject: Re: bug#10015: Guile-2.0.3: test-ffi fails
Date: Sun, 24 Feb 2013 22:16:40 -0500
Hi Hans.  Following up on an old bug report:

Hans Aberg <haberg-1 <at> telia.com> wrote:
> bad return from expression `(f-sum -1 2000 -30000 40000000000)': expected 39999971999; got 39999972255
> FAIL: test-ffi

This turns out to be due to a bug in LLVM, namely that it improperly
assumes that signed integer arguments will be sign-extended by the
caller, although this is not specified by the SysV x86-64 PS ABI.
The recently-released libffi 3.0.12 works around this problem.

If you're interested in the gory details, see:

  http://sourceware.org/ml/libffi-discuss/2013/msg00012.html
  http://gcc.gnu.org/ml/gcc/2013-01/msg00447.html
  http://bugs.gnu.org/13342

We've been told by another MacOS user that the FFI tests now pass when
Guile is linked against libffi 3.0.12, so I'm closing this bug.  Please
let us know if you continue to have problems with the FFI on MacOS.

Thanks again for the bug report!

     Mark




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 25 Mar 2013 11:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 35 days ago.

Previous Next


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