[PATCH 2/3] lib/tests/igt_assert: use volatile cast in igt_assert

Andrzej Hajda andrzej.hajda at intel.com
Tue Jun 17 14:05:24 UTC 2025


Newer versions of clang optimize code more aggresively.
As a result change of variable in subtest is observed
by caller only if it is cast to volatile.

Signed-off-by: Andrzej Hajda <andrzej.hajda at intel.com>
---
 lib/tests/igt_assert.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tests/igt_assert.c b/lib/tests/igt_assert.c
index 3523a46494822cd42f63047c0b5bbb5b39343c84..10c08f9860bb77faa35e4dd46e19d69c94897a7f 100644
--- a/lib/tests/igt_assert.c
+++ b/lib/tests/igt_assert.c
@@ -46,7 +46,7 @@ void (*test_to_run)(void) = NULL;
  */
 #define CHECK_NEG(x) { \
 	igt_subtest_f("XFAIL_simple_%d", __LINE__) { \
-		(*exec_before)++; \
+		(*(volatile int *)(exec_before))++; \
 		x; \
 		raise(SIGBUS); \
 	} \

-- 
2.43.0



More information about the igt-dev mailing list