GNU bug report logs -
#13386
Fwd: bug#13342: Errors trying to build Guile 2.0.7
Previous Next
Reported by: Peter Teeson <peter.teeson <at> me.com>
Date: Tue, 8 Jan 2013 16:10:01 UTC
Severity: normal
Tags: notabug
Merged with 13342
Done: ludo <at> gnu.org (Ludovic Courtès)
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Begin forwarded message:
> From: Peter Teeson <pteeson <at> me.com>
> Subject: Re: bug#13342: Errors trying to build Guile 2.0.7
> Date: 7 January, 2013 8:21:59 PM EST
> To: Ludovic Courtès <ludo <at> gnu.org>
>
> Hi Ludo:
>
> On 2013-01-04, at 12:23 PM, Ludovic Courtès wrote:
>>>>> bad return from expression `(f-sum -1 2000 -30000 40000000000)': expected 39999971999; got 39999972255
>>>>> FAIL: test-ffi
>>>>
>>>> This is a known issue when building Guile with LLVM/Clang:
>>>>
>>>> http://bugs.gnu.org/10015
>>>> http://bugs.gnu.org/10681
>>>>
>>>> It would be great if you could investigate.
>
> Here is the result of my investigation - do you agree?
> My hypothesis is that the scheme interpreter is not calculating the sum correctly based on the following:
>
> (0) First observe this
> "In Apple's version of GCC, both cc and gcc are actually symbolic links to the llvm-gcc compiler. Similarly, c++ and g++ are links to llvm-g++."
>
> (1) Also we note that 39999972255 - 39999971999 = 256!
>
> (2) This program
> //
> // main.c
> // testffi
> //
> // Created by Peter Teeson on 13-01-07.
> // Copyright (c) 2013 PHT Software. All rights reserved.
> //
>
> #include <stdio.h>
> #include <inttypes.h>
>
> int64_t test_ffi_sum (int8_t a, int16_t b,
> int32_t c, int64_t d);
> int64_t test_ffi_sum (int8_t a, int16_t b,
> int32_t c, int64_t d)
> {
> printf("int64 d %" PRId64 " %#llX \n", d,d);
> printf("int32 c %" PRId32 " %#X \n", c,c);
> printf("int16 b %" PRId16 " %#X \n", b,b);
> printf("int08 a %" PRId8 " %#X \n", a,a);
>
> int64_t sum = d + c + b + a;
> printf("int64 sum %" PRId64 " %#llX \n", sum,sum);
>
> return sum;
> }
> int main(int argc, const char * argv[])
> {
> test_ffi_sum(-1, 2000, -30000, 40000000000);
> return 0;
> }
>
> (3) produces this output
>
> int64 d 40000000000 0X9502F9000
> int32 c -30000 0XFFFF8AD0
> int16 b 2000 0X7D0
> int08 a -1 0XFFFFFFFF
> int64 sum 39999971999 0X9502F229F
>
> (4) This function in /guile-2.0.7/test-suite/standalone/test-ffi
> ;;
> ;; Multiple int args of differing types
> ;;
> (define f-sum
> (pointer->procedure int64 (dynamic-func "test_ffi_sum" lib)
> (list int8 int16 int32 int64)))
> (test (f-sum -1 2000 -30000 40000000000)
> (+ -1 2000 -30000 40000000000))
>
> might be the culprit and I am guessing that it is this expression
>
> (+ -1 2000 -30000 40000000000)
>
> which the scheme interpreter is calculating incorrectly. Probably related to -1;
>
> Since I am not familiar with the scheme/guile language I can't go any further than this without help.
> Let me know if I can do more.
>
> respect…..
>
> Peter
[Message part 2 (text/html, inline)]
This bug report was last modified 12 years and 109 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.