summaryrefslogtreecommitdiffstats
path: root/commands/ubsan.c
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2023-06-12 15:02:28 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2023-06-13 09:48:45 +0200
commit1b8a96544828597062daa514059a33ad41826136 (patch)
treeacd5cb53f78267fa5c1e007403585a4057226a07 /commands/ubsan.c
parentf8b3311dd2309a815613341b84df32cc176aedc2 (diff)
downloadbarebox-1b8a96544828597062daa514059a33ad41826136.tar.gz
barebox-1b8a96544828597062daa514059a33ad41826136.tar.xz
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 <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230612130239.1087599-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/ubsan.c')
-rw-r--r--commands/ubsan.c2
1 files changed, 2 insertions, 0 deletions
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;
}