// PR23476 :: stat arrays and foreach

global count
global a

probe begin {
  println("BEGIN")
  count = 1
}

probe kernel.function("vfs_read") {
  a[count] <<< 2*count
  if (count++ > 10) exit()
}

probe end {
  fail = 0
  foreach (k+ in a) {
    val = @sum(a[k])
    printf("%d --> %d, ", k, val)
    if (val != 2 * k) fail = 1
  }
  printf("\n")
  if (fail)
    println("END FAIL")
  else
    println("END PASS")
}
