Wrong return types leak into type inference
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Undecided
|
Unassigned |
Bug Description
I have a SYNTAX-ERROR function in a LABELS body which generates a richer error message and always leaves by calling ERROR, so its return type should be NIL.
But when this is called in other functions, the return type of the _outer_ functions seem to sometimes get added to the inferred return type of SYNTAX-ERROR as well. Style warnings pop out about its return value, and the compiler generates a full call expecting a return.
An extracted error case is attached.
The code executes properly, but the warnings & codegen aren't right.
I found this in my git source builds, including with no .sbclrc or SLIME:
2.1.3.50-e8b780650
2.1.3.83-7328e9955
From IRC, reproducibility might be involved in compiler policy, and this might be old:
<Krystof> White_Flame: funny that people didn't reproduce; I get the same in 1.4.16.debian
<scymtym> i can reproduce it with default and "fast", but not "safe" policy
It seems like the position of the IF in particular to returning possible values for its function might be related. Deeper nested usages of SYNTAX-ERROR in other functions don't cause this info leak.
Linux wfdis 5.4.0-70-generic #78~18.04.1-Ubuntu SMP Sat Mar 20 14:10:07 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
(:DECLARE-TYPES :QUICKLISP :ASDF3.3 :ASDF3.2 :ASDF3.1 :ASDF3 :ASDF2 :ASDF
:OS-UNIX :NON-BASE-
:ANSI-CL :COMMON-LISP :ELF :IEEE-FLOATING-
:PACKAGE-
:SB-THREAD :SB-UNICODE :SBCL :UNIX)