Opened 10 years ago

Closed 10 years ago

#664 closed defect (fixed)

(declare (type (or null (function (t) t)) x)) causes error Error: "Function types are not a legal argument to TYPEP"

Reported by: james.anderson Owned by: gb
Priority: normal Milestone:
Component: Compiler Version: 1.4
Keywords: Cc:

Description

while testing clx, with ccl-1-4, i observed that it misinterprets type declarations. it appears that this is a change from ccl-1-1. the actual instance was in clx's buffer.lisp#write-sequence-card8.

? yoda:/Development/Source/production/Library/de/setf/graphics janson$ /Development/Applications/LISP/ccl-1-3/dppccl
;Loading #P"P-LIBRARY:net;common-lisp;asdf;asdf.lisp.newest"...
Welcome to Clozure Common Lisp Version 1.3-r11936  (DarwinPPC32)!
? (defun test-type (x)
        (declare (type (or null (function (t) t)) x))
        x)
TEST-TYPE
? (disassemble 'test-type)
  (TWNEI NARGS 4)
  (MFLR LOC-PC)
  (BLA .SPSAVECONTEXTVSP)
  (VPUSH ARG_Z)
  (LWZ ARG_Z 0 VSP)
  (BA .SPPOPJ)
? (test-type #'(lambda (x) x))
#<Anonymous Function #x87253D6>
? ^D
? ^D
? yoda:/Development/Source/production/Library/de/setf/graphics janson$ /Development/Applications/LISP/ccl-1-4/dppccl
;Loading #P"P-LIBRARY:net;common-lisp;asdf;asdf..newest"...
Welcome to Clozure Common Lisp Version 1.4-r13119  (DarwinPPC32)!
? (defun test-type (x)
        (declare (type (or null (function (t) t)) x))
        x)
TEST-TYPE
? (disassemble 'test-type)
  (TWNEI NARGS 4)
  (MFLR LOC-PC)
  (BLA .SPSAVECONTEXTVSP)
  (VPUSH ARG_Z)
  (LWZ ARG_Y 0 VSP)
  (LWZ ARG_Z '(OR NULL (FUNCTION (T) T)) FN)
  (LWZ TEMP3 'TYPEP FN)
  (SET-NARGS 2)
  (VPUSH ARG_Y)
  (LWZ TEMP2 6 TEMP3)
  (LWZ TEMP0 -2 TEMP2)
  (MTCTR TEMP0)
  (BCTRL)
  (CMPWI ARG_Z NIL)
  (LWZ ARG_Y 0 VSP)
  (LA VSP 4 VSP)
  (BNE L84)
  (LI ARG_X '157)
  (LWZ ARG_Z '(OR NULL (FUNCTION (T) T)) FN)
  (SET-NARGS 3)
  (BLA .SPKSIGNALERR)
L84 
  (LWZ ARG_Z 0 VSP)
  (BA .SPPOPJ)
? (test-type nil)
NIL
? (test-type #'(lambda (x) x))
> Error: Function types are not a legal argument to TYPEP:
>          (FUNCTION (T) T)
> While executing: CCL::%%TYPEP, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > :a

it is possible to suppress the check

? (defun test-type (x)
        (declare (optimize (speed 3) (safety 0)))
        (declare (type (or null (function (t) t)) x))
        x)
TEST-TYPE
? (disassemble 'test-type)
  (MFLR LOC-PC)
  (LWZ IMM0 44 RCONTEXT)
  (STWU SP -16 SP)
  (STW FN 4 SP)
  (STW LOC-PC 8 SP)
  (STW VSP 12 SP)
  (MR FN TEMP2)
  (TWLLT SP IMM0)
  (VPUSH ARG_Z)
  (LWZ ARG_Z 0 VSP)
  (LWZ LOC-PC 8 SP)
  (LWZ VSP 12 SP)
  (LWZ FN 4 SP)
  (MTLR LOC-PC)
  (LA SP 16 SP)
  (BLR)
? (test-type #'(lambda (x) x))
#<Anonymous Function #x8890F76>
? 

with extreme measures. is there some intermediate way to control this?

Change History (2)

comment:1 Changed 10 years ago by gz

This is fixed in the trunk with r13488. If nothing untoward happens with the fix in the next couple days, I'll merge it into 1.4.

comment:2 Changed 10 years ago by rme

  • Resolution set to fixed
  • Status changed from new to closed

(In [13534]) Merge r13488 to 1.4 branch from trunk; fixes ticket:664.

Note: See TracTickets for help on using tickets.