(nth-value 1 (integer-decode-float least-positive-double-float)) causes bad things to happen.
Describe the bug
Using
(nth-value 1 (integer-decode-float least-positive-double-float))
causes bad things to happen.
To Reproduce
There are two ways to see something bad happen.
First, try the following:
* (defun foo ()
(nth-value 1 (integer-decode-float least-positive-double-float)))
FOO
* (compile 'foo)
; Compiling LAMBDA NIL:
; Compiling Top-Level Form:
FOO
NIL
NIL
* (foo)
; Evaluation aborted on #<KERNEL:SIMPLE-PROGRAM-ERROR {611D12FD}>.
* (disassemble 'foo)
611b8870: .entry foo() ; (function nil t)
88: pop dword ptr [ebp-8]
8b: lea esp, [ebp-20]
8e: test ecx, ecx ; [:non-local-entry]
90: jne L0
92: nop ; No-arg-parsing entry point
; [:non-local-entry]
93: nop
94: nop
95: nop
96: nop
97: nop
98: nop
99: nop
9a: nop
9b: nop
9c: nop
9d: nop
9e: nop
9f: nop
a0: L0: ud1 ecx, edx ; Trap 10: Error trap
a3: .byte #x02
a4: .byte #x1a ; INVALID-ARGUMENT-COUNT-ERROR
a5: .byte #x4f ; ECX
; No value
What happened to the body? It should return -1126
.
Changing the value from least-positive-double-float
to pi
works
fine. It also works fine for least-positive-normalized-double-float
.
A second way is to do
(defparameter foo
(nth-value 1 (integer-decode-float least-positive-double-float)))
You need to place it in a file and compile it; running it directly in the repl works.
When you load the file, you get a sigill.
Expected behavior
This should work.
My guess is that the compiler is mishandling integer-decode-float
with a constant arg that could be converted to a simple multiple-value
return. Perhaps the combination with nth-value
of a fixed set of
known multiple values messes things up.
Desktop (please complete the following information):
- OS: Linux
- Version: snapshot-2021-07 (21D Unicode)