Opened 6 years ago

Last modified 6 years ago

#1299 new defect

Incorrect deletion of (aref v -1).

Reported by: markcox Owned by:
Priority: normal Milestone: Future Clozure CL
Component: ANSI CL Compliance Version: 1.10
Keywords: Cc:


The code (aref v -1) is being deleted by the compiler in the example below despite the subscript being invalid.

(let ((v (make-array 5)))
  (declare (optimize (safety 3) (debug 3) (speed 1) (compilation-speed 1)))
  (aref v -1)
;;; Returns nil rather than signalling an error.

Change History (2)

comment:1 Changed 6 years ago by gb

If the spec (CLHS) said that "an error is (or should be) signalled" in your example and no error ss signalled, then the behavior you report would clearly not be compliant.

I'm not sure that the observed behavior is desirable, but I'm not sure that the spec says anything at all about this case.

See CLHS 1.4.2 for a review of error terminology.

comment:2 Changed 6 years ago by markcox

I see. Thanks for the link to CLHS 1.4.2. CLHS is also relevant here too: "Except as explicitly specified otherwise, the consequences are undefined if these type restrictions are violated."

My apologies for the incorrect language and for not consulting the spec prior to submitting the ticket.

Note: See TracTickets for help on using tickets.