main module arrayinit // Shows praxis 7.2 bug. 7.1 works // the array BAD is initialized incorrectly // bad[0] gets what bad[1] should get // bad[1] gets whar bad[2] should get // ... // bad[4] gets garbage // // // // works when: // 1. BAD is made static // 2. BAD array indices are changed from 0..4 to 1..5 // // Program crashes when indices changed to 2..6 // only starting at 1 gives proper solution // // No effect when: // 1. change to TABLE constructor instead of [1]: ..., [2]: ... use TEXTIO declare color_string_type is packed array[1..8] of char string1 = "string1 " string2 = "string2 " string3 = "string3 " string4 = "string4 " string5 = "string5 " bad_type is array[0..4] of color_string_type bad: bad_type initially table bad_type (string1 ,string2 ,string3 ,string4 ,string5 ) enddeclare out_integer (tty, low(bad), "Low=", true) out_integer (tty, high(bad), "High=", true) for i := low(bad) to high(bad) do out_integer (tty, i, "Bad ") out_string (tty, " ") out_string (tty, bad[i]) out_record (tty) endfor endmodule