Answering my own question:
proc int32AddOverflow(a, b: int32, c: var int32): bool {.
importc: "__builtin_sadd_overflow", nodecl, nosideeffect.}
var rez: int32
if int32AddOverflow(int32(2147483647),int32(1),rez):
echo "overflows!"
else:
echo rez
if int32AddOverflow(int32(2147483646),int32(1),rez):
echo "overflows!"
else:
echo "did not overflow: ", rez
Run
**Output:**
overflows!
did not overflow: 2147483647
Run
