This way we don't have to hard-code per-architecture instructions.
@@ -113,7 +113,7 @@ int main(int argc, char** argv)
if (do_illegal_instruction || do_all_crash_types) {
any_failures |= !Crash("Illegal instruction", []() {
- asm volatile("ud2");
+ __builtin_trap();
return Crash::Failure::DidNotCrash;
}).run(run_type);
}
@@ -15,7 +15,7 @@ int main(int, char**)
pthread_create(
&tid, nullptr, [](void*) -> void* {
sleep(1);
return nullptr;
},
nullptr);
@@ -214,8 +214,9 @@ int atexit(void (*handler)())
void _abort()
{
- __builtin_unreachable();
+ // According to the GCC manual __builtin_trap() can call abort() so using it here might not seem safe at first. However,
+ // on all the platforms we support GCC emits an undefined instruction instead of a call.
void abort()