Branch: Tag:

2014-12-04

2014-12-04 19:23:15 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler (amd64): Fixed bug in F_POS_INT_INDEX.

The range check in F_POS_INT_INDEX used the wrong comparison opcode
which caused indexing of arrays with their size to be allowed.

Added some corresponding tests to the testsuite.

Thanks to Stewa for the report.

8417:      test_eq([[class Z { mixed `->(mixed x) { return this_object()[x]; } int foo() { return 1; }}()->foo()]],1)    + // Test some indexing opcodes. + test_eval_error([[return ({1})[1];]]) + test_eval_error([[int i = 1; return ({1})[i];]]) + test_eval_error([[array a = ({ 1 }); return a[1];]]) + test_eval_error([[array a = ({ 1 }); int i = 1; return a[i];]]) +    // index assigning   test_any(mixed a=({1}); a[0]=2; return equal(a,({2})),1)   test_any(mixed a=(<1>); a[1]=2; return equal(a,(<1>)),1)