[cfe-dev] Feature request: C intrinsics for overflow detection

Andy Lutomirski luto at amacapital.net
Fri May 9 10:27:34 PDT 2014


LLVM has the llvm.*.with.overflow.* intrinsics.  Can these be exposed
to C code?  I imagine this would be straightforward, aside from the
obligatory bikeshedding about exactly what the interface should be.

This would eliminate a lot of nasty hacks used to check for overflow,
especially for multiplication overflow.  I currently write this stuff
in inline x86 assembler -- ugh!  And maybe gcc would go along if clang
paved the way :)

--Andy



More information about the cfe-dev mailing list