On 11/09/21 15:42, Richard W.M. Jones wrote:
On Tue, Nov 09, 2021 at 02:39:38PM +0000, Richard W.M. Jones wrote:
> clang also implements these, but from what I'm reading online it seems
> they were buggy in at least earlier versions.
Actually the clang bug doesn't look that bad, it seems like an obscure
corner case that we're unlikely to hit:
https://bugs.llvm.org/show_bug.cgi?id=16404
Since GCC and Clang are the only two compilers we support we might as
well use these functions IMHO.
I agree.
(This is the first time I've heard of GCC's integer overflow builtins!)
(One data point: in edk2, at long last, a library called SafeIntLib had
been introduced, for the same purpose. The initial implementation needed
some fixes, but that doesn't diminish the value of hiding these tricky
overflow checks behind a well-defined API.)
Thanks,
Laszlo