# test integer limits. Set and print variables and print constants.

set test "optim_arridx"
set ::result_string {# globals
elide_idx1:long
arr2:long [long]
arr1:long [long, long]
arr3:long [long]
elide_global_a:long
elide_global_b:long
# functions
exit:unknown ()
%{ /* unprivileged */
     atomic_set (session_state(), STAP_SESSION_STOPPING);
     _stp_exit ();
  %}
fna:long (a:long)
return a
fnb:long (a:long, b:long)
return (a) + (b)
# probes
begin /* <- begin */
  # locals
  idx2:long
  j:long
  k:long
  b:long
  m:long
  aa:long
  bb:long
  cc:long
  dd:long
  ee:long
{
(__global_arr2[(__global_elide_idx1) = (1)]) = (10);
(__global_arr2[(idx2) = (2)]) = (20);
(__global_arr2[3]) = (30);
(__global_arr2[(j) = (4)]) = (40);
(__global_arr1[__global_fna__overload_0((k) = (0)), k]) = (1);
(__global_arr1[(b) = (1), b]) = (2);
(__global_arr1[2, 2]) = (3);
(__global_arr3[0]) = (4);
(m) = (1);
for (2; (m) <= (10); (m)++) (__global_arr2[m]) = ((m) * (10));
printf("%d %d %d %d\\n", __global_arr1[0, 0], __global_arr2[0], idx2, j);
(aa) = (__global_fna__overload_0(1));
(bb) = (__global_fnb__overload_0((cc) = (1), (__global_elide_global_a) = (2)));
for (1; (bb) < (10); (bb)++) (cc) += (bb);
for ((dd) = (1); (dd) < (10); 1) (dd) += (1);
if ((__global_elide_global_b) = (1)) (ee) = (1)
;
(cc) = ((dd) = (5));
(cc) = ((4) + ((cc) = (1)));
printf("%d %d %d %d %d\\n", aa, bb, cc, dd, ee);
__global_exit__overload_0();
}
end /* <- end */
{
printf("elide_idx1=%#x\\n", __global_elide_idx1);
}
end /* <- end */
  # locals
  __idx0:long
  __val:long
{
foreach (__val = [__idx0] in __global_arr3-) printf("arr3[%#d]=%#x\\n", __idx0, __val);
}
end /* <- end */
{
printf("elide_global_a=%#x\\n", __global_elide_global_a);
}
end /* <- end */
{
printf("elide_global_b=%#x\\n", __global_elide_global_b);
}
}

# avoid propagating PR17301
set origdir $env(SYSTEMTAP_DIR)
set env(SYSTEMTAP_DIR) /dev/null
stap_run_exact $test $srcdir/$subdir/$test.stp -p2 -v 2>/dev/null
set env(SYSTEMTAP_DIR) $origdir

