shithub: mc

Download patch

ref: 0ed042f0cfb35372cada674f8a5e878b0768a8f0
parent: 9afc669ebe308816f556c87355276ba1b2ec6665
author: Ori Bernstein <[email protected]>
date: Tue Aug 19 13:06:58 EDT 2014

Fix pointer comparisons, and add a test for it.

--- a/parse/type.c
+++ b/parse/type.c
@@ -275,6 +275,7 @@
     switch (tybase(t)->type) {
         case Tybyte: case Tyuint8: case Tyuint16: case Tyuint:
         case Tychar: case Tyuint32: case Tyuint64: case Tyulong:
+        case Typtr:
             return 1;
         default:
             return 0;
--- /dev/null
+++ b/test/ptrcmp.myr
@@ -1,0 +1,13 @@
+use std
+
+const main = {
+	var a, b, v1, v2
+
+	v1 = 42
+	v2 = 42
+	a = &v1
+	b = &v1
+	std.assert(a == b, "pointers should be equal, but weren't\n")
+	std.assert(a != b, "pointers weren't equal, but should be\n")
+	std.exit(0)
+}
--- a/test/tests
+++ b/test/tests
@@ -65,6 +65,7 @@
 B condiftrue	E	7
 B condiffalse	E	9
 B condifrel	E	7
+B ptrcmp	E	0
 B overlappingif	E	2
 #B bigcondarg	C       ## BUGGERED
 B fib		E	21