jasmin-lang / jasmin

Language for high-assurance and high-speed cryptography
MIT License
268 stars 55 forks source link

Fatal error in Stack Allocation #878

Open sarranz opened 2 months ago

sarranz commented 2 months ago

This program

export
fn f () -> reg u64 {
  stack u64 s1;
  reg u64 res;

  res = s1;

  return res;
}

gives

Fatal error: exception File "src/intervalGraphColoring.ml", line 43, characters 6-12: Assertion failed

This is compiler/tests/fail/stack_allocation/x86-64/uninit_stack.jazz. I don't think this is the failure we want, and furthermore, I don't think we should be testing this kind of program with no semantics, lest we revive the nosemantics test directory discussion :)

sarranz commented 2 months ago

An interesting, if irrelevant, remark, is that

export
fn f () -> reg u64 {
  stack u64 s1;
  reg u64 res;

  res = 0;
  res = s1;
  return res;
}

exhibits the same behavior, but

export
fn f () -> reg u64 {
  stack u64 s1;
  reg u64 res;

  res = #MOV(0);
  res = s1;
  return res;
}

compiles just fine.