Skip to content

Commit 264cb79

Browse files
danbevaddaleax
authored andcommitted
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<volatile void**>(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: #28261 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 05b8526 commit 264cb79

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node_process_methods.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ static void Abort(const FunctionCallbackInfo<Value>& args) {
6666
// For internal testing only, not exposed to userland.
6767
static void CauseSegfault(const FunctionCallbackInfo<Value>& args) {
6868
// This should crash hard all platforms.
69-
*static_cast<void**>(nullptr) = nullptr;
69+
volatile void** d = static_cast<volatile void**>(nullptr);
70+
*d = nullptr;
7071
}
7172

7273
static void Chdir(const FunctionCallbackInfo<Value>& args) {

0 commit comments

Comments
 (0)