if statement doesn't raise division-by-zero when divisor is passed from lambda

Bug #1963860 reported by Josh Barth
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Invalid
Undecided
Unassigned

Bug Description

# Steps to Reproduce
1. In sbcl run (funcall (lambda (x) (if (/ 3 x) t)) 0)

# Results
Evaluates to T. Doesn't raise any error.

# Expected Results
Should raise a division-by-zero error. The following statements all work as expected:

(funcall (lambda () (if (/ 3 0) t)))
(funcall (lambda (x) (if (eql (/ 3 x) 3) t)) 0)
(let ((x 0)) (if (/ 3 x) t))

# System

`sbcl --version`: SBCL 2.1.2.nixos
`uname -a`: Linux krypton 5.12.17 #1-NixOS SMP Wed Jul 14 15:00:33 UTC 2021 x86_64 GNU/Linux

(and, yes, I know, (if (/ 3 x)) makes no sense. this was a bit of a rabbit hole. regardless, i still think it's a bug)

Revision history for this message
Stas Boukarev (stassats) wrote :

It's flushed in non-safe code. Add (declare (optimize (safety 3))) if you want it to stay.

Changed in sbcl:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.