PR21518: Use unsigned arithmetic for trapping add/sub functions.
The code in {add,sub}v.i3 routines does not trap when it should, because
it performs the actual add/subtract operation in signed arithmetic,
rather than unsigned.
Patch by Francois-Xavie Coudert!
llvm-svn: 221826
diff --git a/compiler-rt/lib/builtins/addvdi3.c b/compiler-rt/lib/builtins/addvdi3.c
index db45a27..0da3894 100644
--- a/compiler-rt/lib/builtins/addvdi3.c
+++ b/compiler-rt/lib/builtins/addvdi3.c
@@ -21,7 +21,7 @@
COMPILER_RT_ABI di_int
__addvdi3(di_int a, di_int b)
{
- di_int s = a + b;
+ di_int s = (du_int) a + (du_int) b;
if (b >= 0)
{
if (s < a)