diff options
author | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2023-05-09 02:17:34 +0000 |
---|---|---|
committer | Sigrid Solveig Haflínudóttir <sigrid@ftrv.se> | 2023-05-09 02:17:34 +0000 |
commit | 47165e1c2ccc0471349691cc92f64f81984b18c5 (patch) | |
tree | 6e523cfb8660f7fa6bd2bf3d693328786142aeef /sys/src/cmd/7c | |
parent | 090af6255bebf0129c891116b53b31808fe49dc7 (diff) |
5c, 7c: fix !x compilation when x is a negative float
test case:
void
main(int, char **)
{
union {
float f;
u32int u;
}x;
x.u = 1U<<31;
print("%d %d\n", !x.f, x.f == 0.0f);
exits(nil);
}
Diffstat (limited to 'sys/src/cmd/7c')
-rw-r--r-- | sys/src/cmd/7c/cgen.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/cmd/7c/cgen.c b/sys/src/cmd/7c/cgen.c index 6f80f9f36..0be4aac58 100644 --- a/sys/src/cmd/7c/cgen.c +++ b/sys/src/cmd/7c/cgen.c @@ -738,8 +738,11 @@ boolgen(Node *n, int true, Node *nn) if(true) o = OEQ; if(typefd[n->type->etype]) { - gopcode(true ? o | BTRUE : o, nodfconst(0), &nod, Z); - } else + regalloc(&nod1, n, Z); + gmove(nodfconst(0.0), &nod1); + gopcode(true ? o | BTRUE : o, &nod1, &nod, Z); + regfree(&nod1); + }else gopcode(o, nodconst(0), &nod, Z); regfree(&nod); goto com; |