./p4_16_errors/div1.p4 is incorrectly rejected for negative values
The testcase is
action act() {
bit<8> a;
a = a / -1;
a = -5 / a;
a = a % -1;
a = -5 % a;
}
But -1 here is really -8w1 (aka 8w0xff) and not -1. -5 should be similar too. It looks like the check for negativeness happens before the implicit conversion happens. I noticed this while using my frontend with testcases (after converting them into a format for the testsuite I use).
I don't think the spec says which happens first: the conversion or the check. So this looks like a legal behavior. The main question is whether we need to change the spec. I think from a usability point of view these programs are wrong, even if the conversion happens first, because they will give a very different result than what the user is probably expecting.
@jnfoster what does Petra do here?
Petr4 accepts it.