[PATCH 2/3] lib/tests/igt_assert: use volatile cast in igt_assert
Kamil Konieczny
kamil.konieczny at linux.intel.com
Wed Jun 18 16:02:17 UTC 2025
Hi Andrzej,
On 2025-06-17 at 16:05:24 +0200, Andrzej Hajda wrote:
> 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.
Nice catch!
Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
>
> 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