Subject: bug#13386: closed (Re: bug#13342: Errors trying to build Guile 2.0.7)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 30 Jan 2013 21:38:04 +0000

Your bug report

#13342: Fwd: bug#13342: Errors trying to build Guile 2.0.7

which was filed against the guile package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
13342: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13342
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#13342: Errors trying to build Guile 2.0.7
From: [email-masked] (Ludovic Courtès)
To: Mark H Weaver <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Wed, 30 Jan 2013 22:37:07 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

tags 13342 notabug
thanks

Hello!

Mark H Weaver <[email-masked]> skribis:

> FYI, I've posted about this to the libffi-discuss mailing list.
>
> http://sourceware.org/ml/libffi-discuss/2013/msg00012.html

Thanks!  So, according to
<http://gcc.gnu.org/ml/gcc/2013-01/msg00449.html>, this is an LLVM bug.

Peter: would you like to report it over at LLVM?

Anyway, closing this bug now.  Thanks!

Ludo’.

Subject: Fwd: bug#13342: Errors trying to build Guile 2.0.7
From: Peter Teeson <[email-masked]>
To: [email-masked]
Date: Tue, 08 Jan 2013 11:08:22 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Begin forwarded message:

> From: Peter Teeson <[email-masked]>
> 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 <[email-masked]>
> 
> 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