Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#182 closed defect (fixed)

ADJUST-ARRAY failure

Reported by: Mark Evenson Owned by: somebody
Priority: major Milestone: unscheduled
Component: other Version: 1.0
Keywords: adjust-array, ansi conformance Cc:
Parent Tickets:

Description

Helmut Eller reported on armedbear-devel:

Evaluating this form

(adjust-array (make-array 2 :element-type '(unsigned-byte 8)) 4)

prints a longish stacktrace that doesn't seem right:

Armed Bear Common Lisp 1.1.0-dev-svn-13692M
Java 1.6.0_18 Sun Microsystems Inc.
OpenJDK Client VM
Low-level initialization completed in 0.771 seconds.
Startup completed in 2.209 seconds.
Type ":help" for a list of available commands.
CL-USER(1): (adjust-array (make-array 2 :element-type '(unsigned-byte 8)) 4)
java.lang.ArrayStoreException
at java.lang.System.arraycopy(Native Method)
at org.armedbear.lisp.BasicVector_UnsignedByte8.adjustArray(BasicVector_UnsignedByte8.java:291)
at org.armedbear.lisp.BasicVector_UnsignedByte8.adjustArray(BasicVector_UnsignedByte8.java:40)
at org.armedbear.lisp.adjust_array.execute(adjust_array.java:95)
at org.armedbear.lisp.Symbol.execute(Symbol.java:896)
at org.armedbear.lisp.Autoload.execute(Autoload.java:258)
at org.armedbear.lisp.Symbol.execute(Symbol.java:896)
at org.armedbear.lisp.LispThread.execute(LispThread.java:798)
at org.armedbear.lisp.arrays_2.execute(arrays.lisp:46)
at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:112)
at org.armedbear.lisp.LispThread.execute(LispThread.java:666)
at org.armedbear.lisp.Lisp.evalCall(Lisp.java:548)
at org.armedbear.lisp.Lisp.eval(Lisp.java:506)
at org.armedbear.lisp.Primitives$pf__eval.execute(Primitives.java:345)
at org.armedbear.lisp.LispThread.execute(LispThread.java:649)
at org.armedbear.lisp.Lisp.evalCall(Lisp.java:541)
at org.armedbear.lisp.Lisp.eval(Lisp.java:506)
at org.armedbear.lisp.Lisp.progn(Lisp.java:675)
at org.armedbear.lisp.Primitives$sf_block.execute(Primitives.java:3733)
at org.armedbear.lisp.Lisp.eval(Lisp.java:496)
at org.armedbear.lisp.Lisp.progn(Lisp.java:675)
at org.armedbear.lisp.Closure.bindParametersAndExecute(Closure.java:451)
at org.armedbear.lisp.Closure.execute(Closure.java:484)
at org.armedbear.lisp.LispThread.execute(LispThread.java:649)
at org.armedbear.lisp.Lisp$1.execute(Lisp.java:277)
at org.armedbear.lisp.Symbol.execute(Symbol.java:785)
at org.armedbear.lisp.LispThread.execute(LispThread.java:649)
at org.armedbear.lisp.top_level_50.execute(top-level.lisp:415)
at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:92)
at org.armedbear.lisp.Symbol.execute(Symbol.java:775)
at org.armedbear.lisp.LispThread.execute(LispThread.java:633)
at org.armedbear.lisp.top_level_51.execute(top-level.lisp:423)
at org.armedbear.lisp.LispThread.execute(LispThread.java:633)
at org.armedbear.lisp.Interpreter.run(Interpreter.java:360)
at org.armedbear.lisp.Main$1.run(Main.java:48)
at java.lang.Thread.run(Thread.java:636)
#<THREAD "interpreter" {3DC13D}>: Debugger invoked on condition of type ERROR
 Caught java.lang.ArrayStoreException.
Restarts:
 0: TOP-LEVEL Return to top level.
[1] CL-USER(2):

Reproduced.

Change History (3)

comment:1 Changed 13 years ago by ehuelsmann

The solution to the problem is in BasicVector_UnsignedByte8.java:290-292, which should be:

        byte[] newElements = new byte[newCapacity];
        System.arraycopy(elements, 0, newElements, 0,
                         Math.min(capacity, newCapacity));

Note that this change alone doesn't compile, because it breaks line 295.

comment:2 Changed 13 years ago by ehuelsmann

Resolution: fixed
Status: newclosed

(In [13707]) Fix #182: ADJUST-ARRAY failure.

comment:3 Changed 13 years ago by ehuelsmann

(In [13708]) Follow-up to last commit: Fix #182.

Note: See TracTickets for help on using tickets.