jasmin icon indicating copy to clipboard operation
jasmin copied to clipboard

AT_inline flag remains

Open eponier opened this issue 4 years ago • 6 comments

I was playing with a toy example (on the glob_array3 branch) and get the error in the title. Probably, the example makes no sense, but I was asked to report it, so here it is.

export fn main (reg u64 x) -> reg u64 {
  stack u64[10] t;
  reg u64 res;
  inline int i;
  inline int j;

  for i = 0 to 10 {
    t[i] = i;
    res = 2 * i;
    j =(int) res;
    t[j] += x;
  }
  res = t[0];

  return res;
}

eponier avatar Mar 17 '21 13:03 eponier

(I was asked by Jasmin with a kind PLEASE REPORT)

eponier avatar Mar 17 '21 16:03 eponier

Interestingly, on master the error is different: linearisation error assign not a word (but I am also asked to report it).

eponier avatar Mar 18 '21 09:03 eponier

After discussing with Benjamin, the error is justified, but should be improved (the PLEASE REPORT should be removed).

eponier avatar Mar 18 '21 14:03 eponier

Another example:

export fn main (reg u64 r) -> reg u64 {
  reg u64 res;
  reg bool b b2;

  b = r == 0;
  b2 = r == 1;

  res = 0;
  if (b && b2) {
    res = 1;
  }

  return res;
}

fails with

"test_bool.jazz", line 5 (2-13):
internal compilation error:
  AT_inline flag remains in instruction:
    b = ZF; /* bool:i */

The inline instructions are introduced by lowering.

eponier avatar Mar 14 '22 15:03 eponier

This example can not be compiled. b and b2 will receive the zf flag. So maybe we should not emit an "internal compilation error" and more a user error.

bgregoir avatar Mar 14 '22 19:03 bgregoir

Interestingly, the first program now passes correctly on latest main. Maybe the pass propagate_inline_variable fixed the problem. The second program still produces the error, though.

eponier avatar Jul 05 '22 15:07 eponier

Fixed by #313.

eponier avatar Jan 04 '23 16:01 eponier