#64 closed defect (fixed)
"maze" benchmark produces incorrect result when compiled wirth -block on x86-64
| Reported by: | felix winkelmann | Owned by: | |
|---|---|---|---|
| Priority: | critical | Milestone: | |
| Component: | core libraries | Version: | 4.1.x | 
| Keywords: | Cc: | Mario Domenech Goulart | |
| Estimated difficulty: | 
Description
(reported by mario)
Some initial testing by adding debugging output to bit-test indicates a bit-twiddling problem.
Change History (8)
comment:1 Changed 16 years ago by
comment:3 follow-up: 4 Changed 16 years ago by
The bitwise-and with a large unsigned integer on line 239 in maze.scm causes the result to be unsigned.
(bitwise-and -1 4611686018427387902) => 4611686018427387902
comment:4 Changed 16 years ago by
Replying to sjamaan:
The bitwise-and with a large unsigned integer on line 239 in maze.scm causes the result to be unsigned.
(bitwise-and -1 4611686018427387902) => 4611686018427387902
Isn't that correct?
BTW, block mode will have an influence because of increased constant folding.
comment:5 Changed 16 years ago by
yeah, it's correct.  It took me a while to understand what the code was doing and what the issue at hand actually is. Never mind my silly comments :)
comment:6 Changed 16 years ago by
The constant-folding of (bitwise-not south) results in a literal object that is incorrectly re-created. Doing C_fix on the result of strtod returns a wrong value.
comment:7 Changed 16 years ago by
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
The problem appears to be that on 64-bit platforms, the fixnum-range exceeds the range of integers that can be stored in a double. While decoding a literal with C_decode_literal, the string->number conversion didn't take this into account. Fixed in r15413.


Adding this patch to
maze.scm:felix@frohike% diff -u benchmarks/maze.scm maze2.scm ~/chicken-4.1.0 --- benchmarks/maze.scm 2009-08-04 10:03:07.000000000 +0200 +++ maze2.scm 2009-08-06 10:11:48.000000000 +0200 @@ -646,7 +646,9 @@ (write-ch #\newline)))) (define (bit-test j bit) - (not (zero? (bitwise-and j bit)))) + (let ((n (not (zero? (bitwise-and j bit))))) + (print "bit-test: " j " " bit " -> " n) + n)) ;;; Return a . if harr[r,c] is marked, otherwise a space. ;;; We use the dot to mark the solution path.produces this diff: