[CRIU] [PATCH 07/23] zombie00 test: fix for clang

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


CLang doesn't like explicit NULL pointer dereference:

> zombie00.c:52:5: error: indirection of non-volatile null pointer will be
> deleted, not trap [-Werror,-Wnull-dereference]
>                                 *(int *)NULL = 0;
>                                 ^~~~~~~~~~~~
> zombie00.c:52:5: note: consider using __builtin_trap() or qualifying
> pointer with 'volatile'
> 1 error generated.

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

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

diff --git a/test/zdtm/static/zombie00.c b/test/zdtm/static/zombie00.c
index 8ee9c07..df12a70 100644
--- a/test/zdtm/static/zombie00.c
+++ b/test/zdtm/static/zombie00.c
@@ -49,7 +49,7 @@ int main(int argc, char ** argv)
 			if (zombie[i].exited)
 				_exit(zombie[i].exitcode);
 			else if (zombie[i].exitcode == SIGSEGV)
-				*(int *)NULL = 0;
+				*(volatile int *)NULL = 0;
 			else
 				kill(getpid(), zombie[i].exitcode);
 
-- 
2.7.4



More information about the CRIU mailing list