From 264cb79bc2e22cc56fbbd742b8c7bf723e9ce5e2 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 17 Jun 2019 07:58:58 +0200 Subject: [PATCH] src: silence compiler warning node_process_methods Currently, the following compiler warning is generated by clang: ../src/node_process_methods.cc:71:3: warning: indirection of non-volatile null pointer will be deleted, not trap [-Wnull-dereference] *static_cast(nullptr) = nullptr; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/node_process_methods.cc:71:3: note: consider using __builtin_trap() or qualifying pointer with 'volatile' 1 warning generated. This commit adds the volatile qualifier to avoid this warning. PR-URL: https://github.com/nodejs/node/pull/28261 Reviewed-By: Joyee Cheung Reviewed-By: Anna Henningsen Reviewed-By: Franziska Hinkelmann Reviewed-By: Yongsheng Zhang Reviewed-By: Colin Ihrig --- src/node_process_methods.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 912ac9bec23960..b34cbf89b6c87f 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -66,7 +66,8 @@ static void Abort(const FunctionCallbackInfo& args) { // For internal testing only, not exposed to userland. static void CauseSegfault(const FunctionCallbackInfo& args) { // This should crash hard all platforms. - *static_cast(nullptr) = nullptr; + volatile void** d = static_cast(nullptr); + *d = nullptr; } static void Chdir(const FunctionCallbackInfo& args) {