From 1b8a96544828597062daa514059a33ad41826136 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 12 Jun 2023 15:02:28 +0200 Subject: commands: ubsan: hide pointer provenance used to trigger UB 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 Link: https://lore.barebox.org/20230612130239.1087599-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- commands/ubsan.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'commands/ubsan.c') diff --git a/commands/ubsan.c b/commands/ubsan.c index 620b4774c3..4a9716139c 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; } -- cgit v1.2.3