1. Wubin Qu
  2. pypy

Commits

Armin Rigo  committed c69c9b7

For completeness, a test for 'P=W' in addition to 'W=P'.

  • Participants
  • Parent commits 4f4c1bd
  • Branches stm-thread-2

Comments (0)

Files changed (1)

File pypy/translator/stm/test/test_transform2.py

View file
  • Ignore whitespace
         assert res == 1
         assert self.barriers == ['P2W', '=']
 
+    def test_pointer_compare_3(self):
+        X = lltype.GcStruct('X', ('foo', lltype.Signed))
+        def f1(x, y):
+            y.foo = 41
+            return x != y
+        x = lltype.malloc(X, immortal=True)
+        y = lltype.malloc(X, immortal=True)
+        res = self.interpret(f1, [x, y])
+        assert res == 1
+        assert self.barriers == ['P2W', '=']
+        res = self.interpret(f1, [x, x])
+        assert res == 0
+        assert self.barriers == ['P2W', '=']
+
     def test_pointer_compare_4(self):
         X = lltype.GcStruct('X', ('foo', lltype.Signed))
         def f1(x, y):