Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCL fails while printing a vector with standard IO syntax #471

Closed
galdor opened this issue Dec 26, 2023 · 6 comments
Closed

CCL fails while printing a vector with standard IO syntax #471

galdor opened this issue Dec 26, 2023 · 6 comments

Comments

@galdor
Copy link

galdor commented Dec 26, 2023

(let ((vector (make-array 0 :element-type '(unsigned-byte 64)
                          :adjustable t :fill-pointer 0)))
  (vector-push-extend 1 vector)
  (vector-push-extend 2 vector)
  (vector-push-extend 3 vector)
  (with-standard-io-syntax
    (print `(make-array ,(length vector)
                        :element-type (unsigned-byte 64)
                        :initial-contents ,vector))))

With SBCL:

(MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #A((4) (UNSIGNED-BYTE 64) 1 2 3 0)) 

With CCL 1.12.2:

(MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTEN> Error of type PRINT-NOT-READABLE: Attempt to print object #<VECTOR 4 fill-pointer 3 type (UNSIGNED-BYTE 64), adjustable> on stream #<BASIC-CHARACTER-OUTPUT-STREAM UTF-8 (TTY/1) #x3020004BCB5D> .
> While executing: CCL::PRINT-NOT-READABLE-ERROR, in process listener(1).
 (7F7419050E50) : 0 (PRINT-CALL-HISTORY :CONTEXT NIL :PROCESS NIL :ORIGIN NIL :DETAILED-P T :COUNT 1152921504606846975 :START-FRAME-NUMBER 0 :STREAM #<error printing object> :PRINT-LEVEL 2 :PRINT-LENGTH 5 :PRINT-STRING-LENGTH :DEFAULT :SHOW-INTERNAL-FRAMES NIL :FORMAT :TRADITIONAL) 965
  (&KEY :CONTEXT :PROCESS :ORIGIN :DETAILED-P :COUNT :START-FRAME-NUMBER :STREAM :PRINT-LEVEL :PRINT-LENGTH :PRINT-STRING-LENGTH :SHOW-INTERNAL-FRAMES :FORMAT)
   CCL::CONTEXT: NIL
   PROCESS: NIL
   CCL::ORIGIN: NIL
   CCL::DETAILED-P: T
   COUNT: 1152921504606846975
   CCL::START-FRAME-NUMBER: 0
   STREAM: #<error printing object>
   CCL::PRINT-LEVEL: 2
   CCL::PRINT-LENGTH: 5
   CCL::PRINT-STRING-LENGTH: :DEFAULT
   CCL::SHOW-INTERNAL-FRAMES: NIL
   FORMAT: :TRADITIONAL

  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  CCL::FRAME-NUMBER: 0
  *BACKTRACE-PRINT-LEVEL*: 2
  *BACKTRACE-PRINT-LENGTH*: 5
  *BACKTRACE-PRINT-STRING-LENGTH*: :DEFAULT
  *BACKTRACE-FORMAT*: :TRADITIONAL
  *STANDARD-OUTPUT*: #<error printing object>
  *PRINT-CIRCLE*: NIL

 (7F7419050FE8) : 1 (ABNORMAL-APPLICATION-EXIT) 277
  NIL

  #:G157294: (ERROR)
  CCL::%HANDLERS%: ((ERROR) (ERROR #<error printing object>) (ERROR #<error printing object>) (ERROR #<error printing object>) (PROCESS-RESET))

 (7F7419051018) : 2 (BREAK-LOOP-HANDLE-ERROR #<error printing object> 17517076587027) 1701
  (CONDITION *TOP-ERROR-FRAME*)
   CONDITION: #<error printing object>
   *TOP-ERROR-FRAME*: 17517076587027

  CCL::BOGUS-GLOBALS: NIL
  CCL::NEWVALS: NIL
  CCL::OLDVALS: NIL

 (7F7419051070) : 3 (%ERROR #<error printing object> NIL 17517076587027) 365
  (CONDITION CCL::ARGS CCL::ERROR-POINTER)
   CONDITION: #<error printing object>
   CCL::ARGS: NIL
   CCL::ERROR-POINTER: 17517076587027



 (7F7419051098) : 4 (PRINT-NOT-READABLE-ERROR #<error printing object> #<error printing object>) 93
  (CCL::OBJECT STREAM)
   CCL::OBJECT: #<error printing object>
   STREAM: #<error printing object>



 (7F74190510B8) : 5 (%PRINT-UNREADABLE-OBJECT #<error printing object> #<error printing object> NIL NIL #<error printing object>) 133
  (CCL::OBJECT STREAM TYPE CCL::ID CCL::THUNK)
   CCL::OBJECT: #<error printing object>
   STREAM: #<error printing object>
   TYPE: NIL
   CCL::ID: NIL
   CCL::THUNK: #<error printing object>



 (7F74190510F0) : 6 (WRITE-AN-ARRAY #<error printing object> #<error printing object> 1152921504606846974) 2469
  (ARRAY STREAM CCL::LEVEL)
   ARRAY: #<error printing object>
   STREAM: #<error printing object>
   CCL::LEVEL: 1152921504606846974

  CCL::RANK: 1
  CCL::VECTOR?: T
  CCL::SIMPLE?: NIL
  CCL::SIMPLE-VECTOR?: NIL
  CCL::STRING?: NIL
  CCL::BIT-VECTOR?: NIL
  CCL::FILL-POINTER?: T
  CCL::ADJUSTABLE?: T
  CCL::DISPLACED?: #<error printing object>
  CCL::TOTAL-SIZE: 4
  LENGTH: 3
  CCL::PRINT-LENGTH: 1152921504606846975
  CCL::PRINT-ARRAY: T
  #:G152290: #<error printing object>

 (7F7419051190) : 7 (FUNCALL (FUNCTION #<#<error printing object>>) #<error printing object> #<error printing object>) 2341
  (CCL::OBJECT STREAM)
   CCL::OBJECT: #<error printing object>
   STREAM: #<error printing object>

  CCL::LEVEL: 1152921504606846974
  CCL::%TYPE: CCL::VECTOR-HEADER

 (7F74190511C0) : 8 (%CALL-NEXT-METHOD (NIL #<error printing object> . 17517076587091)) 1069
  (CCL::MAGIC &REST CCL::ARGS)
   CCL::MAGIC: (NIL #<error printing object> . 17517076587091)
   CCL::ARGS: NIL

  CCL::NEXT-METHODS: (#<error printing object>)
  CCL::ARGS: 17517076587091
  CDR: NIL
  METHOD-FUNCTION: #<error printing object>

 (7F7419051238) : 9 (%%STANDARD-COMBINED-METHOD-DCODE (#<error printing object> #<error printing object>) 17517076587091) 773
  (CCL::METHODS CCL::ARGS)
   CCL::METHODS: (#<error printing object> #<error printing object>)
   CCL::ARGS: 17517076587091

  CCL::CAR-METHS: #<error printing object>
  CCL::CELL-2: (#<error printing object> . 17517076587091)
  CCL::MAGIC: (NIL #<error printing object> . 17517076587091)
  #:G130078: #<error printing object>

 (7F74190512B0) : 10 (WRITE-A-FROB #<error printing object> #<error printing object> 1152921504606846974 NIL) 173
  (CCL::OBJECT STREAM CCL::LEVEL CCL::LIST-KLUDGE)
   CCL::OBJECT: #<error printing object>
   STREAM: #<error printing object>
   CCL::LEVEL: 1152921504606846974
   CCL::LIST-KLUDGE: NIL

  CCL::%CURRENT-WRITE-STREAM%: #<error printing object>
  CCL::%CURRENT-WRITE-LEVEL%: 1152921504606846974

 (7F7419051328) : 11 (WRITE-INTERNAL #<error printing object> #<error printing object> 1152921504606846974 NIL) 853
  (STREAM CCL::OBJECT CCL::LEVEL CCL::LIST-KLUDGE)
   STREAM: #<error printing object>
   CCL::OBJECT: #<error printing object>
   CCL::LEVEL: 1152921504606846974
   CCL::LIST-KLUDGE: NIL

  #:COMPILER-VAR: (NIL)
  #:HANDLER: #<error printing object>
  #:G151777: (ERROR #<error printing object>)
  CCL::%HANDLERS%: ((ERROR #<error printing object>) (ERROR #<error printing object>) (ERROR #<error printing object>) (PROCESS-RESET))

 (7F7419051388) : 12 (WRITE-A-FROB (#<error printing object>) #<error printing object> 1152921504606846974 1152921504606846970) 333
  (CCL::OBJECT STREAM CCL::LEVEL CCL::LIST-KLUDGE)
   CCL::OBJECT: (#<error printing object>)
   STREAM: #<error printing object>
   CCL::LEVEL: 1152921504606846974
   CCL::LIST-KLUDGE: 1152921504606846970



 (7F74190513B8) : 13 (WRITE-INTERNAL #<error printing object> (3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>) 1152921504606846974 1152921504606846974) 853
  (STREAM CCL::OBJECT CCL::LEVEL CCL::LIST-KLUDGE)
   STREAM: #<error printing object>
   CCL::OBJECT: (3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>)
   CCL::LEVEL: 1152921504606846974
   CCL::LIST-KLUDGE: 1152921504606846974

  #:COMPILER-VAR: (NIL)
  #:HANDLER: #<error printing object>
  #:G151777: (ERROR #<error printing object>)
  CCL::%HANDLERS%: ((ERROR #<error printing object>) (ERROR #<error printing object>) (PROCESS-RESET))

 (7F7419051418) : 14 (WRITE-A-CONS (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>) #<error printing object> 1152921504606846975) 381
  (CONS STREAM CCL::LEVEL)
   CONS: (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>)
   STREAM: #<error printing object>
   CCL::LEVEL: 1152921504606846975

  CCL::PRINT-LENGTH: 1152921504606846975
  CCL::LEVEL-1: 1152921504606846974
  CCL::HEAD: MAKE-ARRAY
  CCL::TAIL: (3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>)

 (7F7419051460) : 15 (FUNCALL (FUNCTION #<#<error printing object>>) (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>) #<error printing object>) 181
  (CCL::OBJECT STREAM)
   CCL::OBJECT: (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>)
   STREAM: #<error printing object>

  CCL::LEVEL: 1152921504606846975
  CCL::%TYPE: CONS

 (7F7419051490) : 16 (%CALL-NEXT-METHOD (NIL #<error printing object> . 17517076587181)) 1069
  (CCL::MAGIC &REST CCL::ARGS)
   CCL::MAGIC: (NIL #<error printing object> . 17517076587181)
   CCL::ARGS: NIL

  CCL::NEXT-METHODS: (#<error printing object>)
  CCL::ARGS: 17517076587181
  CDR: NIL
  METHOD-FUNCTION: #<error printing object>

 (7F7419051508) : 17 (%%STANDARD-COMBINED-METHOD-DCODE (#<error printing object> #<error printing object>) 17517076587181) 773
  (CCL::METHODS CCL::ARGS)
   CCL::METHODS: (#<error printing object> #<error printing object>)
   CCL::ARGS: 17517076587181

  CCL::CAR-METHS: #<error printing object>
  CCL::CELL-2: (#<error printing object> . 17517076587181)
  CCL::MAGIC: (NIL #<error printing object> . 17517076587181)
  #:G130078: #<error printing object>

 (7F7419051580) : 18 (WRITE-A-FROB (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>) #<error printing object> 1152921504606846975 NIL) 173
  (CCL::OBJECT STREAM CCL::LEVEL CCL::LIST-KLUDGE)
   CCL::OBJECT: (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>)
   STREAM: #<error printing object>
   CCL::LEVEL: 1152921504606846975
   CCL::LIST-KLUDGE: NIL

  CCL::%CURRENT-WRITE-STREAM%: #<error printing object>
  CCL::%CURRENT-WRITE-LEVEL%: 1152921504606846975

 (7F74190515F8) : 19 (WRITE-INTERNAL #<error printing object> (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>) 1152921504606846975 NIL) 853
  (STREAM CCL::OBJECT CCL::LEVEL CCL::LIST-KLUDGE)
   STREAM: #<error printing object>
   CCL::OBJECT: (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>)
   CCL::LEVEL: 1152921504606846975
   CCL::LIST-KLUDGE: NIL

  #:COMPILER-VAR: (NIL)
  #:HANDLER: #<error printing object>
  #:G151777: (ERROR #<error printing object>)
  CCL::%HANDLERS%: ((ERROR #<error printing object>) (PROCESS-RESET))

 (7F7419051658) : 20 (WRITE-1 (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>) #<error printing object> 1152921504606846975) 573
  (CCL::OBJECT STREAM &OPTIONAL CCL::LEVELS-LEFT)
   CCL::OBJECT: (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>)
   STREAM: #<error printing object>
   CCL::LEVELS-LEFT: 1152921504606846975



 (7F7419051680) : 21 (PRINT (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>) NIL) 141
  (CCL::OBJECT &OPTIONAL STREAM)
   CCL::OBJECT: (MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #<error printing object>)
   STREAM: NIL

  *PRINT-ESCAPE*: T

 (7F74190516B8) : 22 (FUNCALL (FUNCTION #<Anonymous Function #x3020004EDB1F>)) 1453
  NIL

  VECTOR: #<error printing object>
  *PACKAGE*: #<error printing object>
  *PRINT-ARRAY*: T
  *PRINT-BASE*: 10
  *PRINT-CASE*: :UPCASE
  *PRINT-CIRCLE*: NIL
  *PRINT-ESCAPE*: T
  *PRINT-GENSYM*: T
  *PRINT-LENGTH*: NIL
  *PRINT-LEVEL*: NIL
  *PRINT-LINES*: NIL
  *PRINT-MISER-WIDTH*: NIL
  *PRINT-PPRINT-DISPATCH*: #<error printing object>
  *PRINT-PRETTY*: NIL
  *PRINT-RADIX*: NIL
  *PRINT-READABLY*: T
  *PRINT-RIGHT-MARGIN*: NIL
  *READ-BASE*: 10
  *READ-DEFAULT-FLOAT-FORMAT*: SINGLE-FLOAT
  *READ-EVAL*: T
  *READ-SUPPRESS*: NIL
  *READTABLE*: #<error printing object>
  *PRINT-ABBREVIATE-QUOTE*: NIL
  *PRINT-STRUCTURE*: T
  *PRINT-SIMPLE-VECTOR*: NIL
  *PRINT-SIMPLE-BIT-VECTOR*: NIL
  *PRINT-STRING-LENGTH*: NIL

 (7F7419051A18) : 23 (FUNCALL (FUNCTION #<(:INTERNAL CCL::WITH-COMPILATION-UNIT-BODY CCL::LOAD-FROM-STREAM)>)) 781
  NIL

  CCL::ENV: #<error printing object>
  CCL::*NX-SOURCE-NOTE-MAP*: #<error printing object>
  CCL::*LOADING-TOPLEVEL-LOCATION*: #<error printing object>
  PRINT: NIL
  CCL::VAL: (LET ((VECTOR (MAKE-ARRAY 0 :ELEMENT-TYPE (QUOTE (UNSIGNED-BYTE 64)) :ADJUSTABLE T :FILL-POINTER 0))) (VECTOR-PUSH-EXTEND 1 VECTOR) (VECTOR-PUSH-EXTEND 2 VECTOR) (VECTOR-PUSH-EXTEND 3 VECTOR) (WITH-STANDARD-IO-SYNTAX (PRINT (LIST* (QUOTE MAKE-ARRAY) (LIST* (LENGTH VECTOR) (LIST* :ELEMENT-TYPE (LIST* (QUOTE (UNSIGNED-BYTE 64)) (LIST* :INITIAL-CONTENTS (LIST VECTOR)))))))))
  CCL::EOF-VAL: (NIL)
  STREAM: #<error printing object>

 (7F7419051A90) : 24 (CALL-WITH-COMPILATION-UNIT #<error printing object> :OVERRIDE NIL) 197
  (CCL::THUNK &KEY :OVERRIDE)
   CCL::THUNK: #<error printing object>
   CCL::OVERRIDE: NIL

  #:COMPILER-VAR: T
  CCL::*OUTSTANDING-DEFERRED-WARNINGS*: #<error printing object>

 (7F7419051AD8) : 25 (LOAD-FROM-STREAM #<error printing object> NIL) 397
  (STREAM PRINT)
   STREAM: #<error printing object>
   PRINT: NIL

  CCL::EOF-VAL: (NIL)
  CCL::VAL: (LET ((VECTOR (MAKE-ARRAY 0 :ELEMENT-TYPE (QUOTE (UNSIGNED-BYTE 64)) :ADJUSTABLE T :FILL-POINTER 0))) (VECTOR-PUSH-EXTEND 1 VECTOR) (VECTOR-PUSH-EXTEND 2 VECTOR) (VECTOR-PUSH-EXTEND 3 VECTOR) (WITH-STANDARD-IO-SYNTAX (PRINT (LIST* (QUOTE MAKE-ARRAY) (LIST* (LENGTH VECTOR) (LIST* :ELEMENT-TYPE (LIST* (QUOTE (UNSIGNED-BYTE 64)) (LIST* :INITIAL-CONTENTS (LIST VECTOR)))))))))
  #:WITH-COMPILATION-UNIT-BODY: #<error printing object>

 (7F7419051B18) : 26 (%LOAD #P"/tmp/test.lisp" NIL NIL :ERROR :DEFAULT NIL) 5565
  (CCL::FILE-NAME CCL::VERBOSE PRINT CCL::IF-DOES-NOT-EXIST EXTERNAL-FORMAT CCL::PRESERVE-OPTIMIZATION-SETTINGS)
   CCL::FILE-NAME: #P"/tmp/test.lisp"
   CCL::VERBOSE: NIL
   PRINT: NIL
   CCL::IF-DOES-NOT-EXIST: :ERROR
   EXTERNAL-FORMAT: :DEFAULT
   CCL::PRESERVE-OPTIMIZATION-SETTINGS: NIL

  CCL::SOURCE-FILE: #P"/tmp/test.lisp"
  *LOAD-PATHNAME*: #P"/tmp/test.lisp"
  *LOAD-TRUENAME*: #P"/tmp/test.lisp"
  *PACKAGE*: #<error printing object>
  *READTABLE*: #<error printing object>
  CCL::*LOADING-FILES*: (#P"/tmp/test.lisp")
  *LOADING-FILE-SOURCE-FILE*: "/tmp/test.lisp"
  CCL::*LOADING-TOPLEVEL-LOCATION*: NIL
  #:G151305: #<error printing object>
  #:G151306: NIL
  STREAM: #<error printing object>

 (7F7419051C60) : 27 (LOAD "/tmp/test.lisp" :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST :ERROR :EXTERNAL-FORMAT :DEFAULT :PRESERVE-OPTIMIZATION-SETTINGS NIL) 1061
  (CCL::FILE-NAME &KEY :VERBOSE :PRINT :IF-DOES-NOT-EXIST :EXTERNAL-FORMAT :PRESERVE-OPTIMIZATION-SETTINGS)
   CCL::FILE-NAME: "/tmp/test.lisp"
   CCL::VERBOSE: NIL
   PRINT: NIL
   CCL::IF-DOES-NOT-EXIST: :ERROR
   EXTERNAL-FORMAT: :DEFAULT
   CCL::PRESERVE-OPTIMIZATION-SETTINGS: NIL

  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:COMPILER-VAR: NIL
  #:LOAD-OTHER: #<error printing object>
  #:SKIP-LOAD: #<error printing object>
  #:RETRY-LOAD: #<error printing object>
  #:G151246: (#<error printing object> #<error printing object> #<error printing object>)
  CCL::%RESTARTS%: ((#<error printing object> #<error printing object> #<error printing object>) (#<error printing object>) (#<error printing object>) (#<error printing object> #<error printing object>))

 (7F7419051D08) : 28 (FUNCALL (FUNCTION #<(:INTERNAL CCL::LOAD-FILE CCL::STARTUP-CCL)>) "/tmp/test.lisp") 501
  (CCL::NAME)
   CCL::NAME: "/tmp/test.lisp"

  #:CONTINUE: #<error printing object>
  #:G156874: (#<error printing object>)
  CCL::%RESTARTS%: ((#<error printing object>) (#<error printing object>) (#<error printing object> #<error printing object>))

 (7F7419051D50) : 29 (STARTUP-CCL NIL) 1773
  (&OPTIONAL CCL::INIT-FILE)
   CCL::INIT-FILE: NIL

  #:ABORT: #<error printing object>
  #:G156864: (#<error printing object>)
  CCL::%RESTARTS%: ((#<error printing object>) (#<error printing object> #<error printing object>))
  #:G156869: ((:LOAD . "/tmp/test.lisp"))
  CCL::P: (:LOAD . "/tmp/test.lisp")
  CCL::PARAM: "/tmp/test.lisp"
  #:G156872: :LOAD

 (7F7419051DB0) : 30 (FUNCALL (FUNCTION #<(:INTERNAL (TOPLEVEL-FUNCTION (CCL::LISP-DEVELOPMENT-SYSTEM T)))>)) 69
  NIL

  CCL::F: CCL::LISTENER-FUNCTION
  CCL::INIT-FILE: ("home:ccl-init" "home:\\.ccl-init")

 (7F7419051DD0) : 31 (FUNCALL (FUNCTION #<(:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS)>)) 661
  NIL

  *TERMINAL-IO*: #<error printing object>
  CCL::CLOSE-STREAMS: NIL
  CCL::CLEANUP-FUNCTION: #<error printing object>
  CCL::INITIAL-FUNCTION: #<error printing object>
  CCL::AUTO-FLUSH: T
  OUTPUT-STREAM: #<error printing object>
  INPUT-STREAM: #<error printing object>
  CCL::ECHOING: T

 (7F7419051E68) : 32 (RUN-PROCESS-INITIAL-FORM #<error printing object> (#<error printing object>)) 717
  (PROCESS CCL::INITIAL-FORM)
   PROCESS: #<error printing object>
   CCL::INITIAL-FORM: (#<error printing object>)

  CCL::EXITED: NIL
  #:G159212: (PROCESS-RESET)
  CCL::%HANDLERS%: ((PROCESS-RESET))
  #:ABORT: #<error printing object>
  #:ABORT-BREAK: #<error printing object>
  #:G159213: (#<error printing object> #<error printing object>)
  CCL::%RESTARTS%: ((#<error printing object> #<error printing object>))

 (7F7419051EF0) : 33 (FUNCALL (FUNCTION #<(:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS)))>) #<error printing object> (#<error printing object>)) 581
  (PROCESS CCL::INITIAL-FORM)
   PROCESS: #<error printing object>
   CCL::INITIAL-FORM: (#<error printing object>)

  *CURRENT-PROCESS*: #<error printing object>
  #:G159198: (*PRINT-PPRINT-DISPATCH* CCL::*FREE-XPS* CCL::*FREE-CIRCULARITY-HASH-TABLES* CCL::*LOGICAL-BLOCK-XP* CCL::*FORMAT-TOP-LEVEL* CCL::*FORMAT-STREAM-STACK* CCL::*FRAG-FREELIST* CCL::*X86-LAP-FRAG-VECTOR-FREELIST* CCL::*X86-LAP-LABEL-FREELIST* *QUERY-IO* *DEBUG-IO* *TRACE-OUTPUT* *ERROR-OUTPUT* *STANDARD-OUTPUT* *STANDARD-INPUT* CCL::%TOKEN-STRINGS% *READ-BASE* *READ-SUPPRESS* *READ-DEFAULT-FLOAT-FORMAT* *READ-EVAL* *READTABLE* CCL::*DEFAULT-RIGHT-MARGIN* *PRINT-LINES* *PRINT-MISER-WIDTH* *PRINT-RIGHT-MARGIN* *PRINT-READABLY* *PRINT-GENSYM* *PRINT-ARRAY* *PRINT-CASE* *PRINT-CIRCLE* *PRINT-LENGTH* *PRINT-LEVEL* *PRINT-RADIX* *PRINT-BASE* *PRINT-PRETTY* *PRINT-ESCAPE* *PRINT-STRING-LENGTH* *PRINT-SIMPLE-BIT-VECTOR* *PRINT-SIMPLE-VECTOR* *PRINT-STRUCTURE* *PRINT-ABBREVIATE-QUOTE* CCL::*BACKTRACE-CONTEXTS* CCL::%STRING-OUTPUT-STREAM-IOBLOCKS% CCL::*CONS-POOL* *ERROR-PRINT-STRING-LENGTH* *ERROR-PRINT-LEVEL* *ERROR-PRINT-LENGTH* *RANDOM-STATE* *PACKAGE*)
  #:G159199: (#<error printing object> NIL NIL NIL NIL NIL #<error printing object> #<error printing object> #<error printing object> #<error printing object> #<error printing object> #<error printing object> #<error printing object> #<error printing object> #<error printing object> #<error printing object> 10 NIL SINGLE-FLOAT T #<error printing object> 70 NIL 40 NIL NIL T T :UPCASE NIL NIL NIL NIL 10 NIL T NIL NIL NIL T T NIL #<error printing object> #<error printing object> :DEFAULT 8 20 #.(CCL::INITIALIZE-MRG31K3P-STATE 314159 42 1776 271828 6021023 1066) #<error printing object>)
  CCL::*INTERRUPT-LEVEL*: 0
  #:G159200: ("Active")
  #:G159201: "Reset"

 (7F7419051F98) : 34 (FUNCALL (FUNCTION #<(:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION)>)) 277
  NIL

  CCL::*CURRENT-LISP-THREAD*: #<error printing object>
  CCL::INITIAL-FUNCTION: (#<error printing object> #<error printing object> (#<error printing object>))
  CCL::TCR: 17517076901542
  CCL::THREAD: #<error printing object>

Version 1.12.2  LinuxX8664
@informatimago
Copy link

The problem is that you're asking to print this vector readably. sbcl uses an implementation specific syntax, so it's de-facto non-conforming code.

Now there may be a question of interpretation of the standard, whether printing readably is limited to same implementation loopbacks, or whether it should be possible across implementations. (Also, whether other *print-...* settings must be taken into account (a strict reading would make us print symbols fully qualified and escaped).

IMO, printing readably notably with standard-io-syntax, should use only standard reader macros syntax. So the bug is in sbcl.

cl-user> 
(let ((vector (make-array 0 :element-type '(unsigned-byte 64)
                            :adjustable t :fill-pointer 0)))
  (vector-push-extend 1 vector)
  (vector-push-extend 2 vector)
  (vector-push-extend 3 vector)
  (with-standard-io-syntax
    (let ((*print-readably* nil))
      (print `(make-array ,(length vector)
                          :element-type (unsigned-byte 64)
                          :initial-contents ,vector)))))

(MAKE-ARRAY 3 :ELEMENT-TYPE (UNSIGNED-BYTE 64) :INITIAL-CONTENTS #(1 2 3)) 
(make-array 3 :element-type (unsigned-byte 64) :initial-contents #(1 2 3))
cl-user> #A((4) (UNSIGNED-BYTE 64) 1 2 3 0)
> Debug: Reader error on #<string-input-stream  #x3020F1DDAE8D>, near position 2, within "#A((4) (UNSI":
>        reader macro #A used without a rank integer
> While executing: (:internal swank::invoke-default-debugger), in process repl-thread(15).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > :q
; Evaluation aborted on #<ccl::simple-reader-error #x3020F1DDAC0D>.
cl-user> 

(Note the standard-IO-syntax print in uppercase, and the result printed with *print-case* set to :downcase).

galdor added a commit to galdor/tungsten that referenced this issue Dec 26, 2023
@galdor
Copy link
Author

galdor commented Dec 26, 2023

CL Standard 22.1.3.7: "If *print-readably* is true, the vector prints in an implementation-defined manner". WITH-STANDARD-IO-SYNTAX sets *PRINT-READABLY* to T so SBCL isn't non-conformant.

Beyond the fundamental issue of vector printing, I would expect CCL to:

  1. Report precisely the cause of the error.
  2. Print a readable stacktrace instead of dumping a truckload of information that is unexploitable by non-CCL developers (see the multitude of #<error printing object> objects).

@informatimago
Copy link

Oops, you're right. (I don't like it when the standard allows implementation dependent behavior!)

@xrme
Copy link
Member

xrme commented May 14, 2024

The error message could be better, I agree.

The backtrace is unlovely, but I assume that the lisp was running in some context where it couldn't enter an interactive break loop.

@xrme
Copy link
Member

xrme commented May 15, 2024

Issue #253 is about adding an extension to CCL to print arrays readably.

@xrme
Copy link
Member

xrme commented May 16, 2024

3194ef1 provides a hopefully-better message for print-not-readable.

I guess that the #<error printing object> entries in the backtrace may be due to *print-readably* being bound to true.

@xrme xrme closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants