[CRIU] [PATCH 15/23] maps007 test: fix for clang

Kir Kolyshkin kir at openvz.org
Tue Oct 11 18:46:53 PDT 2016


CLang doesn't like explicit NULL pointer dereference:
> maps007.c:176:2: error: indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]
>         *((int *) 0) = 0;
>         ^~~~~~~~~~~~
> maps007.c:176:2: note: consider using __builtin_trap() or qualifying pointer with 'volatile'
>

Apparently, we need to add volatile to make it happy.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 test/zdtm/transition/maps007.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/zdtm/transition/maps007.c b/test/zdtm/transition/maps007.c
index 04568fb..ee5e7c7 100644
--- a/test/zdtm/transition/maps007.c
+++ b/test/zdtm/transition/maps007.c
@@ -173,6 +173,6 @@ int main(int argc, char **argv)
 	return 0;
 err:
 	kill(child, SIGSEGV);
-	*((int *) 0) = 0;
+	*((volatile int *) 0) = 0;
 	return 1;
 }
-- 
2.7.4



More information about the CRIU mailing list