The ubsan command invokes various sort of undefined behavior to verify
that the Undefined Behavior Sanitizer works as expected. Compiler warns
about some of this, which is not helpful, so work around the warning.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
 commands/ubsan.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/commands/ubsan.c b/commands/ubsan.c
index 620b4774c3c2..4a9716139c4b 100644
--- a/commands/ubsan.c
+++ b/commands/ubsan.c
@@ -102,6 +102,8 @@ static void test_ubsan_object_size_mismatch(void)
        volatile long long *ptr, val2;
 
        ptr = (long long *)&val;
+       OPTIMIZER_HIDE_VAR(ptr);
+
        val2 = *ptr;
 }
 
-- 
2.39.2


Reply via email to