You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You use defined(__APPLE__) to decide whether to use __builtin_debugtrap but that's wrong, because only Clang supports that built-in, but GCC defines __APPLE__ too.
The minimal fix would be to just check defined(__clang__) instead of defined(__APPLE__).
I don't see any reason to restrict the use of __builtin_debugtrap() to aarch64 on macOS, you could use it on all platforms when compiling with Clang. For x86 it expands to int 3 which is what your own code does. For ARM it expands to .inst 0xe7f001f0 which is the same as your code again.
To use __builtin_debugtrap() whenever the compiler supports it, you can do something like:
I got the same problem, when trying to use gcc on Apple ARM64 platform.
Checking defined(__clang__) instead or after defined(__APPLE__) would do the job.
The one can argue that using gcc on macOS is very strange use case. While tris is true, it has it's niche for building software in "Linux compatible mode" and it has its value for developers.
For the reference, I'm installing gcc through home brew: brew install gcc.
You use
defined(__APPLE__)
to decide whether to use__builtin_debugtrap
but that's wrong, because only Clang supports that built-in, but GCC defines__APPLE__
too.The minimal fix would be to just check
defined(__clang__)
instead ofdefined(__APPLE__)
.I don't see any reason to restrict the use of
__builtin_debugtrap()
to aarch64 on macOS, you could use it on all platforms when compiling with Clang. For x86 it expands toint 3
which is what your own code does. For ARM it expands to.inst 0xe7f001f0
which is the same as your code again.To use
__builtin_debugtrap()
whenever the compiler supports it, you can do something like:The text was updated successfully, but these errors were encountered: