frankpfenning / C0

C0 Language
4 stars 0 forks source link

Default values not handled correctly by some VM instructions #29

Closed robsimmons closed 11 years ago

robsimmons commented 11 years ago

AADDS should always cause a c0_memory_error when given a NULL pointer, but ARRAYLENGTH should return 0. This is necessary due to the behavior of default-initialized arrays.

The new ATHROW instruction will also have this problem, because NULL is a valid string in C0 equal to the constant "".

robsimmons commented 11 years ago

The test tests/rjs-basic/error5.c0 triggers the ARRAYLENGTH and ATHROW exceptions. The AADDS error is tricky because the bytecode would have almost certainly thrown a segfault naturally anyway, and we don't distinguish checked segfault from undefined-behavior segfault in the VM/

robsimmons commented 11 years ago

This should be resolved as of r173.