GCC builtins in LDC - compiler interoperability

David Nadlinger code at klickverbot.at
Thu Jul 16 01:12:56 UTC 2020

On 16 Jul 2020, at 0:31, Cecil Ward via digitalmars-d-ldc wrote:
> Oh, shame. There’s no __builtin_unreachable in ldc? I wonder if I 
> could work around this with LDC then.

As a general note, LLVM tends not to provide intrinsics with semantics 
that can also be cleanly modelled in the regular LLVM IR. Clang 
implements virtually all GCC intrinsics in the respective header files, 
but does so by providing equivalent implementations manually for many of 

As pointed out in the other response, you can easily access the 
functionality from LDC through inline IR still. A project to write an 
automatic converter to provide full GCC compatibility by building on 
Clang's implementation might be interesting, though.

  — David

More information about the digitalmars-d-ldc mailing list