aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-09-06 16:02:55 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-09-06 16:02:55 +0000
commit52d4b12f6e5833eb4eec7ee2e57120b34c87550b (patch)
treec5da86dbf73523766916f2e6b36ec97760bcb47b
parent6449f0917a8bd6f3182a1d5cada13b50843f6a48 (diff)
MallocBench: gs: zarray: zastore(): correctly subtract unsigned offset
By adding negated unsigned offset, while with wrapping semantics you indeed get a smaller pointer, this `op[]` operation is in-bounds by the standards, and is lowered into `getelementpointer inbounds`, and it is not wrapping. So the fact that we get the correct answer does not matter, we got it illegally. Fix it to actually perform the subtraction, via using negative signed offset /repositories/llvm-test-suite/MultiSource/Benchmarks/MallocBench/gs/zarray.c:75:2: runtime error: addition of unsigned offset to 0x000000b0faa0 overflowed to 0x000000b0fa70 #0 0x24ab6b in zastore (/builddirs/build-test-suite-new/MultiSource/Benchmarks/MallocBench/gs/gs+0x24ab6b) #1 0x245593 in interp (/builddirs/build-test-suite-new/MultiSource/Benchmarks/MallocBench/gs/gs+0x245593) #2 0x244b27 in interpret (/builddirs/build-test-suite-new/MultiSource/Benchmarks/MallocBench/gs/gs+0x244b27) #3 0x241a80 in run_file (/builddirs/build-test-suite-new/MultiSource/Benchmarks/MallocBench/gs/gs+0x241a80) #4 0x241a07 in init2 (/builddirs/build-test-suite-new/MultiSource/Benchmarks/MallocBench/gs/gs+0x241a07) #5 0x2416f1 in argproc (/builddirs/build-test-suite-new/MultiSource/Benchmarks/MallocBench/gs/gs+0x2416f1) #6 0x241d1c in gs_main (/builddirs/build-test-suite-new/MultiSource/Benchmarks/MallocBench/gs/gs+0x241d1c) #7 0x2412cd in main (/builddirs/build-test-suite-new/MultiSource/Benchmarks/MallocBench/gs/gs+0x2412cd) #8 0x7f76cde3409a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #9 0x222029 in _start (/builddirs/build-test-suite-new/MultiSource/Benchmarks/MallocBench/gs/gs+0x222029) Seems to be a preexisting issue, but found while evaluating D67122. git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@371220 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--MultiSource/Benchmarks/MallocBench/gs/zarray.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/MultiSource/Benchmarks/MallocBench/gs/zarray.c b/MultiSource/Benchmarks/MallocBench/gs/zarray.c
index 122ab98d..3b8a18ff 100644
--- a/MultiSource/Benchmarks/MallocBench/gs/zarray.c
+++ b/MultiSource/Benchmarks/MallocBench/gs/zarray.c
@@ -70,7 +70,7 @@ zastore(register ref *op)
size = op->size;
if ( size > op - osbot ) return e_stackunderflow;
refcpy(op->value.refs, op - size, size);
- op[-size] = *op;
+ op[-((intptr_t)size)] = *op;
pop(size);
return 0;
}