opendylan icon indicating copy to clipboard operation
opendylan copied to clipboard

Compiler generates bad code for make(<byte-string>, size: -1)

Open cgay opened this issue 2 years ago • 1 comments

Compiling make(<byte-string>, size: -1) in the playground results in this output:

Open Dylan 2023.1pre
computation *t3(0) := [METHOD-CALLi ^{<&method> make (singleton(<byte-string>))}
  (^{<&class> <byte-string>}, ^#[], ^' ', ^-1)] // tail call: -1 is not of type {<union>: #f, {<limited-integer>}}
emit Ktop_level_initializerF0I: -1 is not of type {<union>: #f, {<limited-integer>}}
Build of 'play-516754b46bc6' completed
in 0.957156 seconds
Illegal instruction

make(<string>, size: -1) is slightly different, with this output:

Open Dylan 2023.1pre
Internal error: -1 is not of type {<union>: #f, {<limited-integer>}}
Exiting with return code 9
in 0.242795 seconds
Illegal instruction

cgay avatar Sep 16 '23 20:09 cgay

Another instance... probably no new info here but just in case.

I changed my buffer-size local variable into a global named *buffer-size* but neglected to update this reference:

  let send-buffer = make(<byte-string>, size: buffer-size, fill: '.');

Which resulted in Illegal Instruction when executed. I didn't notice this non-warning in the compiler output until afterwards:

emit Ktest_low_level_echo_clientVecho_testI: {<&simple-method>} is not of type {<union>: #f, {<limited-integer>}}

cgay avatar Nov 23 '25 04:11 cgay