Skip to content

Commit

Permalink
src: silence compiler warning node_process_methods
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
danbev authored and addaleax committed Jun 19, 2019
1 parent 05b8526 commit 264cb79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node_process_methods.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ static void Abort(const FunctionCallbackInfo<Value>& args) {
// For internal testing only, not exposed to userland.
static void CauseSegfault(const FunctionCallbackInfo<Value>& args) {
// This should crash hard all platforms.
*static_cast<void**>(nullptr) = nullptr;
volatile void** d = static_cast<volatile void**>(nullptr);
*d = nullptr;
}

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

0 comments on commit 264cb79

Please sign in to comment.