From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Peter Teeson Newsgroups: gmane.lisp.guile.bugs Subject: bug#13386: Fwd: bug#13342: Errors trying to build Guile 2.0.7 Date: Tue, 08 Jan 2013 11:08:22 -0500 Message-ID: <8C684CFE-2E0A-48B1-8763-259109433D23@me.com> References: <895C23AD-DD0D-40FC-AD5F-6CEF52365444@me.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="Boundary_(ID_3bAMNUcD/+iMf2CCwDpcNg)" X-Trace: ger.gmane.org 1357661413 9503 80.91.229.3 (8 Jan 2013 16:10:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 8 Jan 2013 16:10:13 +0000 (UTC) To: 13386@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Tue Jan 08 17:10:29 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tsbky-0008Kv-96 for guile-bugs@m.gmane.org; Tue, 08 Jan 2013 17:10:28 +0100 Original-Received: from localhost ([::1]:41146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tsbki-0004GF-BU for guile-bugs@m.gmane.org; Tue, 08 Jan 2013 11:10:12 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsbkY-0003uk-V6 for bug-guile@gnu.org; Tue, 08 Jan 2013 11:10:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsbkU-0006xt-6E for bug-guile@gnu.org; Tue, 08 Jan 2013 11:10:02 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsbkU-0006xl-2H for bug-guile@gnu.org; Tue, 08 Jan 2013 11:09:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TsbkY-0005Ie-9I for bug-guile@gnu.org; Tue, 08 Jan 2013 11:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Peter Teeson Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 08 Jan 2013 16:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13386 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.135766134320289 (code B ref -1); Tue, 08 Jan 2013 16:10:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Jan 2013 16:09:03 +0000 Original-Received: from localhost ([127.0.0.1]:56953 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TsbjZ-0005H1-Nj for submit@debbugs.gnu.org; Tue, 08 Jan 2013 11:09:02 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43512) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TsbjV-0005Gb-7R for submit@debbugs.gnu.org; Tue, 08 Jan 2013 11:08:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsbjD-0006ad-9N for submit@debbugs.gnu.org; Tue, 08 Jan 2013 11:08:47 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:49853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsbjD-0006aZ-5U for submit@debbugs.gnu.org; Tue, 08 Jan 2013 11:08:39 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:54863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsbjA-0003dJ-4f for bug-guile@gnu.org; Tue, 08 Jan 2013 11:08:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tsbj7-0006a7-04 for bug-guile@gnu.org; Tue, 08 Jan 2013 11:08:36 -0500 Original-Received: from nk11p08mm-asmtpout002.mac.com ([17.158.58.247]:57803 helo=nk11p08mm-asmtp002.mac.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tsbj6-0006Zy-Lq for bug-guile@gnu.org; Tue, 08 Jan 2013 11:08:32 -0500 Original-Received: from [192.168.2.10] (bas4-toronto21-1176476140.dsl.bell.ca [70.31.153.236]) by nk11p08mm-asmtp002.mac.com (Oracle Communications Messaging Server 7u4-26.01(7.0.4.26.0) 64bit (built Jul 13 2012)) with ESMTPSA id <0MGB00MHVE5X7T70@nk11p08mm-asmtp002.mac.com> for bug-guile@gnu.org; Tue, 08 Jan 2013 16:08:28 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.9.8327,1.0.431,0.0.0000 definitions=2013-01-08_06:2013-01-08, 2013-01-08, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=6 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1203120001 definitions=main-1301080118 X-Mailer: Apple Mail (2.1283) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6690 Archived-At: --Boundary_(ID_3bAMNUcD/+iMf2CCwDpcNg) Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: quoted-printable Begin forwarded message: > From: Peter Teeson > Subject: Re: bug#13342: Errors trying to build Guile 2.0.7 > Date: 7 January, 2013 8:21:59 PM EST > To: Ludovic Court=E8s >=20 > Hi Ludo: >=20 > On 2013-01-04, at 12:23 PM, Ludovic Court=E8s wrote: >>>>> bad return from expression `(f-sum -1 2000 -30000 40000000000)': = expected 39999971999; got 39999972255 >>>>> FAIL: test-ffi >>>>=20 >>>> This is a known issue when building Guile with LLVM/Clang: >>>>=20 >>>> http://bugs.gnu.org/10015 >>>> http://bugs.gnu.org/10681 >>>>=20 >>>> It would be great if you could investigate. >=20 > 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: >=20 > (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++." >=20 > (1) Also we note that 39999972255 - 39999971999 =3D 256! >=20 > (2) This program > // > // main.c > // testffi > // > // Created by Peter Teeson on 13-01-07. > // Copyright (c) 2013 PHT Software. All rights reserved. > // >=20 > #include > #include >=20 > 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); >=20 > int64_t sum =3D d + c + b + a; > printf("int64 sum %" PRId64 " %#llX \n", sum,sum); >=20 > return sum; > } > int main(int argc, const char * argv[]) > { > test_ffi_sum(-1, 2000, -30000, 40000000000); > return 0; > } >=20 > (3) produces this output >=20 > int64 d 40000000000 0X9502F9000=20 > int32 c -30000 0XFFFF8AD0=20 > int16 b 2000 0X7D0=20 > int08 a -1 0XFFFFFFFF=20 > int64 sum 39999971999 0X9502F229F=20 >=20 > (4) This function in /guile-2.0.7/test-suite/standalone/test-ffi=20 > ;; > ;; 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)) >=20 > might be the culprit and I am guessing that it is this expression >=20 > (+ -1 2000 -30000 40000000000)=20 >=20 > which the scheme interpreter is calculating incorrectly. Probably = related to -1; >=20 > 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. >=20 > respect=85.. >=20 > Peter --Boundary_(ID_3bAMNUcD/+iMf2CCwDpcNg) Content-type: text/html; charset=windows-1252 Content-transfer-encoding: quoted-printable
From: Peter Teeson <pteeson@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=E8s = <ludo@gnu.org>

Hi = Ludo:

On 2013-01-04, at 12:23 PM, Ludovic = Court=E8s 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.

Her= e 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 =3D = 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 =3D 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 
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=85..

Peter
<= br>= --Boundary_(ID_3bAMNUcD/+iMf2CCwDpcNg)--