shithub: mc

Download patch

ref: 1da035ab2c9e8cbbdda631bfc7023b9bced4e61a
parent: ec6e403c3fbefc7929f52610aecb85300e7ad17a
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jul 1 13:52:21 EDT 2018

Make '!=' not hard coded as evaluating to '==' for enum unions.

	Oops.

--- a/mi/flatten.c
+++ b/mi/flatten.c
@@ -386,7 +386,12 @@
 		r = mkexpr(n->loc, Outag, rval(s, n->expr.args[1]), NULL);
 		l->expr.type = mktype(n->loc, Tyuint32);
 		r->expr.type = mktype(n->loc, Tyuint32);
-		e = mkexpr(n->loc, Oueq, l, r, NULL);
+		if (op == Oeq)
+			e = mkexpr(n->loc, Oueq, l, r, NULL);
+		else if (op == One)
+			e = mkexpr(n->loc, Oune, l, r, NULL);
+		else
+			fatal(n, "unsupported operator %s for enum union", opstr[op]);
 		e->expr.type = mktype(n->loc, Tybool);
 		return e;
 	}