Skip to content

Commit 488ada0

Browse files
committed
tests: Avoid aliased Functions in a single Operator in test_w_data
`f` and `g` share their buffer, but the generated code declares their pointers `restrict`, so fusing `Eq(f, f+1)` and `Eq(g, g+1)` into one Operator lets the compiler hoist the load from `g` above the store to `f`. gcc 13 and 14 do exactly that and increment by one instead of two, which is why the test failed on some CI runners and not others. Use one Operator per Function instead.
1 parent 8339590 commit 488ada0

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tests/test_data.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,8 +2187,13 @@ def _w_data(self):
21872187

21882188
check = np.array(f.data_with_halo[1:-1, 1:-1])
21892189

2190-
# Update both
2191-
Operator([Eq(f, f+1), Eq(g, g+1)])()
2190+
# Update both. NOTE: `f` and `g` share their buffer, but the generated
2191+
# code says otherwise -- the pointers are `restrict` qualified -- so
2192+
# they have to be updated by separate Operators. Fusing the two Eqs
2193+
# would leave the compiler free to hoist the load from `g` above the
2194+
# store to `f`, yielding an increment of one rather than two
2195+
Operator(Eq(f, f+1))()
2196+
Operator(Eq(g, g+1))()
21922197
assert np.all(f.data_with_halo == g.data_with_halo)
21932198
# Check that it was incremented by two
21942199
check += 2

0 commit comments

Comments
 (0)