Branch: Tag:

2015-02-19

2015-02-19 12:45:32 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [amd64]: Fix bug in F_FOREACH.

The initial foreach counter may be set to non-zero when foreach goes
over a ranged array. If the initial foreach counter is larger than
the size of the array F_FOREACH started indexing outside the array.

Fixes [bug 7426 (#7426)].

FIXME: Is there a corresponding problem with negative ranges?

8847:   ]],1)      test_any([[ +  // Bug 7426. +  array a = ({}); +  foreach(a[1..], mixed e) return 0; +  return 1; + ]], 1) +  + test_any([[    int ret;    foreach( ([1:2,3:5,7:11,13:17]) ; int a ; int b) ret+=a*b;    return ret;