[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13342: [PARTIALLY SOLVED] bug#13342: Errors trying to build Guile 2.

From: Peter Teeson
Subject: bug#13342: [PARTIALLY SOLVED] bug#13342: Errors trying to build Guile 2.0.7
Date: Sun, 27 Jan 2013 16:35:04 -0500

Hi Ludo:
MacOS 10.7.5 Intel Dual CPU quad cores 

Many thanks for your reply. A nice demo but, no disrespect, maybe not really the issue.
Looking at the generated code from each compiler was going to be my next step after
taking a look at the stack and regs to see what got passed/pushed/popped in the call to test_sum.
Which is why I posted about how can I debug/step through the interpreter. 
I still don't understand how to do that even though I read through the manual.

My experiment in building guile with both compilers indicate they both produce the same error.
bad return from _expression_ `(f-sum -1 2000 -30000 40000000000)': expected 39999971999; got 39999972255
I am still of the opinion that it's an interpreter issue and not a compiler one. 

I ask for help in confirming my understanding of this scheme code from the file 
;; 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)  ;; This calls the c function f-sum
      (+ -1 2000 -30000 40000000000))      ;;  This executes the scheme interpreter to do the sum

Is my understanding correct??????

If so please explain to me how the interpreter knows that the -1 in this _expression_ is an int8?
My suspicion is that it thinks it's an int16 and that's why we see the difference!!

I don't know how to pass an int8 of -1 to the interpreter in REPL mode.
Otherwise I'd try that.

============= from Terminal REPL session =============
Gandalf:guile-2.0.7 pteeson$ guile
GNU Guile 2.0.7
<snipped comments>

scheme@(guile-user)> (+ -1 2000 -30000 40000000000)
$1 = 39999971999
scheme@(guile-user)> ,q

which matches the fail message value.
bad return from _expression_ `(f-sum -1 2000 -30000 40000000000)': expected 39999971999; got 39999972255

Limits of exact-width integer types
Minimum values of exact-width signed integer types:
Exactly -(2 N-1)
Maximum values of exact-width signed integer types:
Exactly 2N-1 -1

reply via email to

[Prev in Thread] Current Thread [Next in Thread]