Hello!

The code below is lifted from /languages/imcc/t/clash.t. I'm trying to understand test writer's intent. Bear with me, please, while I embarass myself:

> ##############################
> output_is(<<'CODE', <<'OUT', "defined");
> .sub _test
>         $P1 = new PerlHash
>         $I0 = defined $P1
>         new P1, .PerlHash
>         defined I0, P1
>         print $I0
>         print "\n"
>         print I0
>         print "\n"
>         end
> .end
> CODE
> 1
> 1
> OUT

1. $I0 (PIR) is set to `defined $P1`;
2. I0 (parrot) is set to `defined P1`. If there is a bug in lifetime analysis, in step 1 above $P1 may mapped to P1. Similarly, $I0 may be mapped to I0;
3. If above-mentioned exists, the two print statements are correct, even if the generated code is incorrect.


Eyebrow raised since file name is 'clash.t', so, in absence of comments about intent, I assume it tries to prove correctness of lifetime clash analysis.

For robustness, a shorter version to test $I*/I* analysis:

  I0 = 2
  $P1 = new PerlHash
  $I0 = defined $P1
  print I0
  print $I0
  # should be 21

Or it may be a different clash altogether. Or I may be wrong...
Flaviu



Reply via email to