jasmin icon indicating copy to clipboard operation
jasmin copied to clipboard

No check that we do not call an export function

Open eponier opened this issue 2 years ago • 1 comments

If we try to call an export function, we do not get a clear message "cannot call an export function". Instead, we can get:

  • an assertion false in regalloc.ml
export fn f(reg u64 arg) -> reg u64 {
  reg u64 res;
  res = arg;
  return res;
}

export fn main () -> reg u64 {
  reg u64 res x;
  x = 2;
  res = f (res);
  res += x;
  return res;
}
  • the error linearisation: (one_varmap) nowhere to store the return address
export fn f(reg u64 arg) -> reg u64 {
  reg u64 res;
  res = arg;
  return res;
}

export fn main () -> reg u64 {
  reg u64 res;
  res = f (res);
  return res;
}

eponier avatar Sep 08 '21 17:09 eponier

Current version says:

typing error: call to export function needs to be inlined

Can this be closed?

vbgl avatar Jul 22 '22 19:07 vbgl

Indeed, the error message is now clear.

eponier avatar Sep 13 '22 16:09 eponier