[PATCH wayland 4/6] tests: Use volatile pointer for NULL dereference

Daniel Stone daniels at collabora.com
Wed Aug 29 06:17:13 UTC 2018


Clang warns that it can silently discard a non-volatile write to a NULL
pointer (perhaps it constitutes undefined behaviour?), and recommends
changing it to volatile.

This patch slavishly complies with the demand of the unfeeling machine.

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 tests/sanity-test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/sanity-test.c b/tests/sanity-test.c
index 66ca16fb..2495a115 100644
--- a/tests/sanity-test.c
+++ b/tests/sanity-test.c
@@ -70,8 +70,10 @@ FAIL_TEST(fail_kill)
 
 FAIL_TEST(fail_segv)
 {
+	char * volatile *null = 0;
+
 	test_disable_coredumps();
-	* (char **) 0 = "Goodbye, world";
+	*null = "Goodbye, world";
 }
 
 FAIL_TEST(sanity_assert)
-- 
2.17.1



More information about the wayland-devel mailing list