unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#10015: Guile-2.0.3: test-ffi fails
@ 2011-11-10 21:16 Hans Aberg
  2011-11-16 19:30 ` Andy Wingo
  2013-02-25  3:16 ` Mark H Weaver
  0 siblings, 2 replies; 9+ messages in thread
From: Hans Aberg @ 2011-11-10 21:16 UTC (permalink / raw)
  To: 10015

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







^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10015: Guile-2.0.3: test-ffi fails
  2011-11-10 21:16 bug#10015: Guile-2.0.3: test-ffi fails Hans Aberg
@ 2011-11-16 19:30 ` Andy Wingo
  2011-11-16 20:16   ` Hans Aberg
  2011-11-17 14:32   ` Hans Aberg
  2013-02-25  3:16 ` Mark H Weaver
  1 sibling, 2 replies; 9+ messages in thread
From: Andy Wingo @ 2011-11-16 19:30 UTC (permalink / raw)
  To: Hans Aberg; +Cc: 10015

On Thu 10 Nov 2011 22:16, Hans Aberg <haberg-1@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/





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10015: Guile-2.0.3: test-ffi fails
  2011-11-16 19:30 ` Andy Wingo
@ 2011-11-16 20:16   ` Hans Aberg
  2011-11-16 21:46     ` Andy Wingo
  2011-11-17 14:32   ` Hans Aberg
  1 sibling, 1 reply; 9+ messages in thread
From: Hans Aberg @ 2011-11-16 20:16 UTC (permalink / raw)
  To: Andy Wingo; +Cc: 10015


On 16 Nov 2011, at 20:30, Andy Wingo wrote:

> On Thu 10 Nov 2011 22:16, Hans Aberg <haberg-1@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







^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10015: Guile-2.0.3: test-ffi fails
  2011-11-16 20:16   ` Hans Aberg
@ 2011-11-16 21:46     ` Andy Wingo
  2011-11-17  8:30       ` Hans Aberg
  0 siblings, 1 reply; 9+ messages in thread
From: Andy Wingo @ 2011-11-16 21:46 UTC (permalink / raw)
  To: Hans Aberg; +Cc: 10015

On Wed 16 Nov 2011 21:16, Hans Aberg <haberg-1@telia.com> writes:

> On 16 Nov 2011, at 20:30, Andy Wingo wrote:
>
>> On Thu 10 Nov 2011 22:16, Hans Aberg <haberg-1@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/





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10015: Guile-2.0.3: test-ffi fails
  2011-11-16 21:46     ` Andy Wingo
@ 2011-11-17  8:30       ` Hans Aberg
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Aberg @ 2011-11-17  8:30 UTC (permalink / raw)
  To: Andy Wingo; +Cc: 10015


On 16 Nov 2011, at 22:46, Andy Wingo wrote:

> On Wed 16 Nov 2011 21:16, Hans Aberg <haberg-1@telia.com> writes:
> 
>> On 16 Nov 2011, at 20:30, Andy Wingo wrote:
>> 
>>> On Thu 10 Nov 2011 22:16, Hans Aberg <haberg-1@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







^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10015: Guile-2.0.3: test-ffi fails
  2011-11-16 19:30 ` Andy Wingo
  2011-11-16 20:16   ` Hans Aberg
@ 2011-11-17 14:32   ` Hans Aberg
  2011-11-18  6:38     ` Andy Wingo
  1 sibling, 1 reply; 9+ messages in thread
From: Hans Aberg @ 2011-11-17 14:32 UTC (permalink / raw)
  To: Andy Wingo; +Cc: 10015

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







^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10015: Guile-2.0.3: test-ffi fails
  2011-11-17 14:32   ` Hans Aberg
@ 2011-11-18  6:38     ` Andy Wingo
  2011-11-18  8:46       ` Hans Aberg
  0 siblings, 1 reply; 9+ messages in thread
From: Andy Wingo @ 2011-11-18  6:38 UTC (permalink / raw)
  To: Hans Aberg; +Cc: 10015

On Thu 17 Nov 2011 15:32, Hans Aberg <haberg-1@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@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/





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10015: Guile-2.0.3: test-ffi fails
  2011-11-18  6:38     ` Andy Wingo
@ 2011-11-18  8:46       ` Hans Aberg
  0 siblings, 0 replies; 9+ messages in thread
From: Hans Aberg @ 2011-11-18  8:46 UTC (permalink / raw)
  To: Andy Wingo; +Cc: 10015

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







^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#10015: Guile-2.0.3: test-ffi fails
  2011-11-10 21:16 bug#10015: Guile-2.0.3: test-ffi fails Hans Aberg
  2011-11-16 19:30 ` Andy Wingo
@ 2013-02-25  3:16 ` Mark H Weaver
  1 sibling, 0 replies; 9+ messages in thread
From: Mark H Weaver @ 2013-02-25  3:16 UTC (permalink / raw)
  To: Hans Aberg; +Cc: 10015-done

Hi Hans.  Following up on an old bug report:

Hans Aberg <haberg-1@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





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-02-25  3:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-10 21:16 bug#10015: Guile-2.0.3: test-ffi fails Hans Aberg
2011-11-16 19:30 ` Andy Wingo
2011-11-16 20:16   ` Hans Aberg
2011-11-16 21:46     ` Andy Wingo
2011-11-17  8:30       ` Hans Aberg
2011-11-17 14:32   ` Hans Aberg
2011-11-18  6:38     ` Andy Wingo
2011-11-18  8:46       ` Hans Aberg
2013-02-25  3:16 ` Mark H Weaver

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).