File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,17 @@ static void Abort(const FunctionCallbackInfo<Value>& args) {
70
70
ABORT ();
71
71
}
72
72
73
- // For internal testing only, not exposed to userland.
73
+ // For internal testing only, not exposed to userland. If possible, disable
74
+ // optimizations since we are technically relying on an undefined behavior that
75
+ // modern compilers like to abuse.
76
+ #ifdef __has_cpp_attribute
77
+ # if __has_cpp_attribute(clang::optnone)
78
+ [[clang::optnone]]
79
+ # endif
80
+ # if __has_cpp_attribute(gnu::optimize)
81
+ [[gnu::optimize(0 )]]
82
+ # endif
83
+ #endif
74
84
static void CauseSegfault (const FunctionCallbackInfo<Value>& args) {
75
85
// This should crash hard all platforms.
76
86
volatile void ** d = static_cast <volatile void **>(nullptr );
You can’t perform that action at this time.
0 commit comments