jcbeaudoin / MKCL

ManKai Common Lisp
Other
33 stars 8 forks source link

Zero-rank result from si:bit-array-op crashes the printer #32

Closed davidmullen closed 6 months ago

davidmullen commented 6 months ago
> (bit-xor (make-array nil :initial-element 1 :element-type 'bit)
           (make-array nil :initial-element 0 :element-type 'bit))

#0A

Debugger called in: #<thread "Initial" active (17877) 0x7f0a91610740 7f0a8ebc5000>.

#<a SEGMENTATION-VIOLATION 139682799659360>:
    Detected access to an invalid or protected memory address at ((nil)).

This was found through automated testing, namely the ANSI test suite.

The cause is the array.elem and array.set fields not being initialized.

jcbeaudoin commented 6 months ago

Your PR fixed this properly.

jcbeaudoin commented 6 months ago

BTW, how many other bugs did this ANSI test suite automated testing did find?

davidmullen commented 6 months ago

A lot of the stuff in the ANSI test suite actually has to do with implementation-dependent behavior. For example: What happens to a symbol when its home package gets deleted? That's implementation-dependent. So the actual bugs I can find mostly have to do with the type system, and in particular the integration of types and classes. Here we have:

> (subtypep 'simple-string 'string)

T
T

But then:

> (subtypep 'simple-string (find-class 'string))

NIL
T
jcbeaudoin commented 6 months ago

This looks more like an historical accident than a conscious design decision. Integration of types and classes should be better indeed. I'll put it on the TODO list.