ccl icon indicating copy to clipboard operation
ccl copied to clipboard

ANSI-TEST FILE-POSITION.8: Not an ivector subtag: 182

Open phoe opened this issue 6 years ago • 4 comments

CCL fails some of the ANSI-TESTs with the following error:

Test CL-TEST::FILE-POSITION.8 failed
Form: (LOOP CL-TEST::FOR CL-TEST::LEN CL-TEST::FROM 33 CL-TEST::TO 100 CL-TEST::FOR CL-TEST::N = (ASH 1 CL-TEST::LEN) DO (WITH-OPEN-FILE (CL-TEST::OS "tmp.dat" :DIRECTION :OUTPUT :IF-EXISTS :SUPERSEDE :ELEMENT-TYPE (LIST* 'UNSIGNED-BYTE (LIST CL-TEST::LEN))) (LOOP CL-TEST::FOR CL-TEST::I CL-TEST::FROM 0 CL-TEST::BELOW 100 CL-TEST::FOR CL-TEST::R = (LOGAND (1- CL-TEST::N) CL-TEST::I) CL-TEST::FOR CL-TEST::POS = (FILE-POSITION CL-TEST::OS) DO (ASSERT (OR (NOT CL-TEST::POS) (EQL CL-TEST::POS CL-TEST::I))) DO (WRITE-BYTE CL-TEST::R CL-TEST::OS))) DO (WITH-OPEN-FILE (CL-TEST::IS "tmp.dat" :DIRECTION :INPUT :ELEMENT-TYPE (LIST* 'UNSIGNED-BYTE (LIST CL-TEST::LEN))) (LOOP CL-TEST::FOR CL-TEST::I CL-TEST::FROM 0 CL-TEST::BELOW 100 CL-TEST::FOR CL-TEST::POS = (FILE-POSITION CL-TEST::IS) DO (ASSERT (OR (NOT CL-TEST::POS) (EQL CL-TEST::POS CL-TEST::I))) DO (LET ((BYTE (READ-BYTE CL-TEST::IS))) (ASSERT (EQL BYTE (LOGAND (1- CL-TEST::N) CL-TEST::I)))))))
Expected value:
          NIL
Actual value:
          #<SIMPLE-ERROR #x302001F2C65D> [Not an ivector subtag: 182]

Reproduced on v1.11.5 and the latest bootstrapping bianries.

I will try to find a minimal working test case.

phoe avatar Nov 16 '19 13:11 phoe

Smaller test case:

(CCL::MAKE-FILE-STREAM #P"/tmp/nonexistent-file.cpp"
                       :IO '(UNSIGNED-BYTE 100)
                       :NEW-VERSION :CREATE
                       'CCL::BASIC-FILE-STREAM :DEFAULT
                       :PRIVATE T)

phoe avatar Nov 16 '19 13:11 phoe

182 is the value of (ccl::element-type-subtype 't) and the actually erroring call is:

(ccl::subtag-bytes (ccl::element-type-subtype t) 1)

It seems that if the array element type gets upgraded all the way to T, then SUBTAG-BYTES is unable to deal with the result.

phoe avatar Nov 16 '19 13:11 phoe

An additional failure is visible on 32bit builds: Not an ivector subtag: 250 where 250 is (ccl::element-type-subtype 'double-float).

Test CL-TEST::STREAM-ELEMENT-TYPE.2 failed
Form: (LET ((CL-TEST::PN "foo.txt")) (LOOP CL-TEST::FOR CL-TEST::I CL-TEST::FROM 1 CL-TEST::TO 100 CL-TEST::FOR CL-TEST::ETYPE = (LIST* 'UNSIGNED-BYTE (LIST CL-TEST::I)) CL-TEST::FOR CL-TEST::S = (PROGN (CL-TEST::DELETE-ALL-VERSIONS CL-TEST::PN) (OPEN CL-TEST::PN :DIRECTION :OUTPUT :ELEMENT-TYPE CL-TEST::ETYPE)) UNLESS (MULTIPLE-VALUE-BIND (CL-TEST::SUB CL-TEST::GOOD) (SUBTYPEP CL-TEST::ETYPE (STREAM-ELEMENT-TYPE CL-TEST::S)) (CLOSE CL-TEST::S) (OR CL-TEST::SUB (NOT CL-TEST::GOOD))) CL-TEST::COLLECT CL-TEST::I))
Expected value:
          NIL
Actual value:
          #<SIMPLE-ERROR #x191D1256> [Not an ivector subtag: 250]

phoe avatar Nov 16 '19 13:11 phoe

The problem here is that we don't support stream bytes longer than a word.

https://trac.clozure.com/ccl/ticket/280

On the other hand, complaining about ivector subtags is not very friendly, and it seems like we ought to be able to do better.

xrme avatar Apr 22 '24 19:04 xrme