jos@cs.vu.nl (Jos Warmer) (03/15/90)
The resize routine is incorrect for zero sized arrays: class FORCE feature s : ARRAY[STRING]; Create is do s.Create(1, 0); s.force("twelve", 12); end; end; Ruinning gives: System execution failed. Below is the sequence of recorded exceptions: -------------------------------------------------------------------------------- Object Class Routine Nature of exception Effect -------------------------------------------------------------------------------- 6C540 ARRAY resize External event: Segmentation fault. Fail -------------------------------------------------------------------------------- 6C540 ARRAY force External event: Segmentation fault. Fail -------------------------------------------------------------------------------- 6CAFC FORCE create External event: Segmentation fault. Fail -------------------------------------------------------------------------------- The problem is identified as follows: In array.resize the C function `arycpy' is called. This function is defined in the file `_basic.c'. It calls the macro `gentest' with first argument `oldarea' (which is the `area' from class array). This macro tries to get the `info' field of area. Beacuse the array is empty, area was never assigned to, so this means dereferencing a null pointer. Ergo: segmentation fault. Jos Warmer jos@cs.vu.nl PS: I sometimes get the same execution failure with non-zerosized arrays. But I cannot reproduce them in a small example. -- Jos Warmer jos@cs.vu.nl ...uunet!mcvax!cs.vu.nl!jos