clang-analyzer pierces the volatile veil and complains that test_ubsan_divrem_overflow() does a division by zero. The division is intentional to exercise UBSAN runtime detection of the condition, so let's hide the fact that val2 is zero using OPTIMIZER_HIDE_VAR. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- commands/ubsan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commands/ubsan.c b/commands/ubsan.c index 4a9716139c4b..634ab2bc60b2 100644 --- a/commands/ubsan.c +++ b/commands/ubsan.c @@ -43,6 +43,8 @@ static void test_ubsan_divrem_overflow(void) volatile int val = 16; volatile int val2 = 0; + OPTIMIZER_HIDE_VAR(&val2); + val /= val2; } -- 2.39.5