Opened 4 years ago

Closed 4 years ago

#1359 closed defect (fixed)

REPLACE fails on vectors with fill-pointer

Reported by: ivan4th Owned by:
Priority: normal Milestone:
Component: other Version: trunk
Keywords: Cc:

Description

CCL trunk, test:

(in-package :cl-user)

(let ((a (make-array 16 :element-type '(unsigned-byte 8) :fill-pointer 11))
      (b (make-array 16 :element-type '(unsigned-byte 8) :fill-pointer 10)))
  (replace a b :start1 1 :end1 11 :start2 0)
  (princ a))

Produces an error:

The value 16 is not of the expected type ARRAY.
[Condition of type TYPE-ERROR]

Restarts:
0: [RETRY] Retry SLIME interactive evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT-BREAK] Reset this thread
3: [ABORT] Kill this thread

Backtrace:
0: (CCL::%ARRAY-IS-HEADER 16)
Locals:
ARRAY = 16
1: (DISPLACED-ARRAY-P #<error printing (VECTOR CCL::UNUSED 10) #x302004A7459D>)
Locals:
ARRAY = #<error printing (VECTOR UNUSED 10) #x302004A7459D>
DISP = #(0 0 0 0 0 0 ...)
TARGET = 16
2: (CCL::WRITE-AN-ARRAY #<error printing (VECTOR CCL::UNUSED 10) #x302004A7459D> #<SWANK/GRAY::SLIME-OUTPUT-STREAM #x302000B6D05D> 1152921504606846975)
3: (#<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT (T T)> #<error printing (VECTOR CCL::UNUSED 10) #x302004A7459D> #<SWANK/GRAY::SLIME-OUTPUT-STREAM #x302000B6D05D>)
4: (CCL::%CALL-NEXT-METHOD (NIL #<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT (T T)> . 17592094079249))
5: (CCL::%%STANDARD-COMBINED-METHOD-DCODE (#<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT :AROUND (T T)> #<CCL::STANDARD-KERNEL-METHOD PRINT-OBJECT (T T)>) 17592094079249)
6: (NIL #<Unknown Arguments>)
7: (CCL::WRITE-A-FROB #<error printing (VECTOR CCL::UNUSED 10) #x302004A7459D> #<SWANK/GRAY::SLIME-OUTPUT-STREAM #x302000B6D05D> 1152921504606846975 NIL)
8: (CCL::WRITE-INTERNAL #<SWANK/GRAY::SLIME-OUTPUT-STREAM #x302000B6D05D> #<error printing (VECTOR CCL::UNUSED 10) #x302004A7459D> 1152921504606846975 NIL)
9: (CCL::WRITE-1 #<error printing (VECTOR CCL::UNUSED 10) #x302004A7459D> #<SWANK/GRAY::SLIME-OUTPUT-STREAM #x302000B6D05D> 1152921504606846975)
10: (PRINC #<error printing (VECTOR CCL::UNUSED 10) #x302004A7459D> NIL)
11: (CCL::CHEAP-EVAL (LET ((A (MAKE-ARRAY 16 :ELEMENT-TYPE '# :FILL-POINTER ...)) (B (MAKE-ARRAY 16 :ELEMENT-TYPE '# :FILL-POINTER ...))) (REPLACE A B :START1 1 :END1 ...) (PRINC A)))
12: ((:INTERNAL SWANK:INTERACTIVE-EVAL))

The culprit is %UVECTOR-REPLACE used in REPLACE function. It uses %SVREF which breaks on non-simple vectors.

Suggested patch is attached.

Attachments (1)

non-simple-vec-replace.patch (600 bytes) - added by ivan4th 4 years ago.

Download all attachments as: .zip

Change History (2)

Changed 4 years ago by ivan4th

comment:1 Changed 4 years ago by gb

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

(In [16739]) in REPLACE. don't call %UVECTOR-REPLCE unless the source sequence is a SIMPLE-ARRAY. Fixes ticket:1359 in the trunk.

Note: See TracTickets for help on using tickets.