Compiler error in comparison of a double float variable with single float positive infinity

Bug #1754456 reported by Paul F. Dietz on 2018-03-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

(lambda (x)
  (declare (type double-float x))
  (assert (< x #.sb-ext:single-float-positive-infinity))
  x)

==>

The value
  NIL
is not of type
  REAL
when binding #:G62125
[...]
  0: (SB-KERNEL::ROUND-NUMERIC-BOUND (NIL) FLOAT DOUBLE-FLOAT NIL)
  1: (SB-KERNEL::NUMBER-SIMPLE-INTERSECTION2-TYPE-METHOD #<SB-KERNEL:NUMERIC-TYPE DOUBLE-FLOAT> #<SB-KERNEL:NUMERIC-TYPE (DOUBLE-FLOAT * (NIL))>)
  2: (SB-KERNEL::%TYPE-INTERSECTION2 #<SB-KERNEL:NUMERIC-TYPE DOUBLE-FLOAT> #<SB-KERNEL:NUMERIC-TYPE (DOUBLE-FLOAT * (NIL))>)
  3: (SB-KERNEL:TYPE-INTERSECTION2 #<SB-KERNEL:NUMERIC-TYPE DOUBLE-FLOAT> #<SB-KERNEL:NUMERIC-TYPE (DOUBLE-FLOAT * (NIL))>)
  4: (SB-KERNEL::SIMPLIFY-INTERSECTIONS (#<SB-KERNEL:NUMERIC-TYPE DOUBLE-FLOAT> #<SB-KERNEL:NUMERIC-TYPE (DOUBLE-FLOAT * (NIL))>))
  5: (SB-KERNEL::%TYPE-INTERSECTION (#<SB-KERNEL:NUMERIC-TYPE DOUBLE-FLOAT> #<SB-KERNEL:NUMERIC-TYPE (DOUBLE-FLOAT * (NIL))>))
  6: (SB-KERNEL::FIXED-VALUES-OP (#<SB-KERNEL:NUMERIC-TYPE DOUBLE-FLOAT>) (#<SB-KERNEL:NUMERIC-TYPE (DOUBLE-FLOAT * (NIL))>) #<SB-KERNEL:NAMED-TYPE NIL> #<FUNCTION SB-KERNEL:TYPE-INTERSECTION>)
  7: (SB-KERNEL::ARGS-TYPE-OP #<SB-KERNEL:VALUES-TYPE (VALUES DOUBLE-FLOAT &OPTIONAL)> #<SB-KERNEL:VALUES-TYPE (VALUES (DOUBLE-FLOAT * (NIL)) &OPTIONAL)> #<FUNCTION SB-KERNEL:TYPE-INTERSECTION> #<FUNCTION ..
  8: (SB-KERNEL::VALUES-TYPE-OP #<SB-KERNEL:VALUES-TYPE (VALUES DOUBLE-FLOAT &OPTIONAL)> #<SB-KERNEL:VALUES-TYPE (VALUES (DOUBLE-FLOAT * (NIL)) &OPTIONAL)> #<FUNCTION SB-KERNEL:TYPE-INTERSECTION> #<FUNCTIO..
  9: (SB-KERNEL:VALUES-TYPE-INTERSECTION #<SB-KERNEL:VALUES-TYPE (VALUES DOUBLE-FLOAT &OPTIONAL)> #<SB-KERNEL:VALUES-TYPE (VALUES (DOUBLE-FLOAT * (NIL)) &OPTIONAL)>)
 10: (SB-C::DERIVE-NODE-TYPE #<SB-C::COMBINATION :FUN #<SB-C::REF :LEAF #<SB-C::CLAMBDA :%SOURCE-NAME SB-C::.ANONYMOUS. :%DEBUG-NAME # :KIND NIL :TYPE #<SB-KERNEL:BUILT-IN-CLASSOID FUNCTION (read-only)> :..
 11: (SB-C::PROPAGATE-FUN-CHANGE #<SB-C::COMBINATION :FUN #<SB-C::REF :LEAF #<SB-C::CLAMBDA :%SOURCE-NAME SB-C::.ANONYMOUS. :%DEBUG-NAME # :KIND NIL :TYPE #<SB-KERNEL:BUILT-IN-CLASSOID FUNCTION (read-only..
 12: (SB-C::IR1-OPTIMIZE-COMBINATION #<SB-C::COMBINATION :FUN #<SB-C::REF :LEAF #<SB-C::CLAMBDA :%SOURCE-NAME SB-C::.ANONYMOUS. :%DEBUG-NAME # :KIND NIL :TYPE #<SB-KERNEL:BUILT-IN-CLASSOID FUNCTION (read-..
[...]

Paul F. Dietz (paul-f-dietz) wrote :

(lambda (x)
  (declare (type double-float x))
  (assert (< x #.sb-ext:single-float-positive-infinity))
  (%f x))

produces a slightly different failure:

The value
  NIL
is not of type
  NUMBER
when binding SB-KERNEL::Y
   [Condition of type TYPE-ERROR]
[...]
  0: (SB-KERNEL:TWO-ARG-= #.SB-EXT:DOUBLE-FLOAT-POSITIVE-INFINITY NIL) [external]
  1: (SB-VM::GENERIC-=)
  2: (SB-C::CONSTRAIN-FLOAT-TYPE #<SB-KERNEL:NUMERIC-TYPE (DOUBLE-FLOAT * (NIL))> #<SB-KERNEL:NUMERIC-TYPE (DOUBLE-FLOAT #.SB-EXT:DOUBLE-FLOAT-POSITIVE-INFINITY #.SB-EXT:DOUBLE-FLOAT-POSITIVE-INFINITY)> NI..
  3: ((FLET SB-C::BODY-FUN :IN SB-C::CONSTRAIN-REF-TYPE) #S(SB-C::CONSTRAINT :NUMBER 1 :KIND < :X #<SB-C::LAMBDA-VAR :%SOURCE-NAME X :TYPE #<SB-KERNEL:NUMERIC-TYPE DOUBLE-FLOAT> :WHERE-FROM :DECLARED {1007..
  4: (SB-KERNEL:%MAP-FOR-EFFECT-ARITY-1 #<CLOSURE (LAMBDA (SB-C::CONSTRAINT) :IN SB-C::CONSTRAIN-REF-TYPE) {1007678FEB}> #(#S(SB-C::CONSTRAINT :NUMBER 1 :KIND < :X #1=#<SB-C::LAMBDA-VAR :%SOURCE-NAME X :TY..
  5: (SB-C::CONSTRAIN-REF-TYPE #<SB-C::REF :%SOURCE-NAME X :LEAF #<SB-C::LAMBDA-VAR :%SOURCE-NAME X :TYPE #<SB-KERNEL:NUMERIC-TYPE DOUBLE-FLOAT> :WHERE-FROM :DECLARED {1007612F43}> {1007617C83}> #S(SB-C::C..
  6: (SB-C::CONSTRAINT-PROPAGATE-IN-BLOCK #<SB-C::CBLOCK 3 :START c1 {10076139E3}> #S(SB-C::CONSET :VECTOR #*11001000 :MIN 0 :MAX 5) T)
  7: (SB-C::CONSTRAINT-PROPAGATE #<SB-C:COMPONENT :NAME (LAMBDA (X) :IN "/home/dietz/g/f/f107.lsp") {1007671823}>)
  8: (SB-C::IR1-PHASES #<SB-C:COMPONENT :NAME (LAMBDA (X) :IN "/home/dietz/g/f/f107.lsp") {1007671823}>)
[...]

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers