[test-suite] r371220 - MallocBench: gs: zarray: zastore(): correctly subtract unsigned offset
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 09:02:56 PDT 2019
Author: lebedevri
Date: Fri Sep 6 09:02:55 2019
New Revision: 371220
URL: http://llvm.org/viewvc/llvm-project?rev=371220&view=rev
Log:
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.
Modified:
test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c
Modified: test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c?rev=371220&r1=371219&r2=371220&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c (original)
+++ test-suite/trunk/MultiSource/Benchmarks/MallocBench/gs/zarray.c Fri Sep 6 09:02:55 2019
@@ -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;
}
More information about the llvm-commits
mailing list