Subject: bug#24908: Possible unboxing bug in master triggered by (format)

From: Daniel Llorens <[email-masked]>
Date: Wed, 9 Nov 2016 14:17:04 +0100

(format #f "~2f" 9.9) fails in master. You can try different combinations, it doesn't fail when it rounds down or there're more spaces for example.

The first bad commit is 0f2f5949a21572fad8355473200c7adc6d74f882 'Better unboxing' on the master branch.

See the full error below. 18446744073709551615 is 2^64-1 of course so it looks like bad signedness somewhere.

Regards

	Daniel

> guile -c '(use-modules (ice-9 format)) (format #f "~2f" 9.9)'
Backtrace:./meta/guile -c '(use-modules (ice-9 format)) (format #f "~2f" 9.9)'
Backtrace:
           8 (apply-smob/1 #<catch-closure 1105c20>)
In ice-9/boot-9.scm:
    704:2  7 (call-with-prompt ("prompt") #<procedure 110a060 at ic…> …)
In ice-9/eval.scm:
    608:8  6 (_ #(#(#<directory (guile-user) 110cf30>)))
In ice-9/command-line.scm:
   181:18  5 (_ #<input: string 1119f50>)
In unknown file:
           4 (eval (format #f "~2f" 9.9) #<directory (guile-user) 11…>)
In ice-9/format.scm:
  1590:19  3 (format #f "~2f" 9.9)
   316:19  2 (format:format-work "~2f" (9.9))
  1142:30  1 (format:out-fixed #f _ _)
  1525:37  0 (format:fn-round _)

ice-9/format.scm:1525:37: In procedure format:fn-round:
ice-9/format.scm:1525:37: In procedure string-ref: Value out of range: 18446744073709551615