(null (handler-case ...)) can evaluate to incorrect result
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
cyan:~% uname -a
Linux cyan 5.4.0-170-generic #188-Ubuntu SMP Wed Jan 10 09:51:01 UTC 2024 x86_6\
4 x86_64 x86_64 GNU/Linux
cyan:~% sbcl --version
SBCL 2.4.1
cyan:~%
The first two evaluations below give the expected result, but the
third does not. In fact the second and third should clearly be the
same -- they just call null in different, but equivalent, places.
This log was produced using SBCL 2.4.1 on Linux, but I also saw it
with SBCL 2.2.10 on MacOS.
* (let ((*my-most-
(declare (special *my-most-
(handler-case
(* *my-most-
(error () nil)))
NIL
* (null (let ((*my-most-
(declare (special *my-most-
(* *my-most-
(error () nil))))
T
* (let ((*my-most-
(declare (special *my-most-
(null (handler-case
(* *my-most-
(error () nil))))
NIL
*
It avoids calling unused functions.