[PATCH 07/19] commands: ubsan: hide pointer provenance used to trigger UB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux