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/subvti3.c b/compiler-rt/lib/builtins/subvti3.c
index 8f11714..a6804d2 100644
--- a/compiler-rt/lib/builtins/subvti3.c
+++ b/compiler-rt/lib/builtins/subvti3.c
@@ -23,7 +23,7 @@
COMPILER_RT_ABI ti_int
__subvti3(ti_int a, ti_int b)
{
- ti_int s = a - b;
+ ti_int s = (tu_int) a - (tu_int) b;
if (b >= 0)
{
if (s > a)