forked from OSchip/llvm-project
acf3279a03
In LazyValueInfoImpl::isNonNullAtEndOfBlock we populate a set of pointers, known to be non-null at the end of a block (e.g. because we did a load through them). We then infer that any pointer, based on an element of this set is non-null as well ("based" here meaning a non-null pointer is the underlying object). This is incorrect, even if the base pointer was non-null, the value of a GEP, that lacks the inbounds` attribute, may be null. This issue appeared as miscompilation of the following test case: int puts(const char *); typedef struct iter { int *val; } iter_t; static long distance(iter_t first, iter_t last) { long r = 0; for (; first.val != last.val; first.val++) ++r; return r; } int main() { int arr[2] = {0}; iter_t i, j; i.val = arr; j.val = arr + 1; if (distance(i, j) >= 2) puts("failed"); else puts("passed"); } This fixes PR49662. Differential Revision: https://reviews.llvm.org/D99642 |
||
---|---|---|
.. | ||
Analysis | ||
Assembler | ||
Bindings | ||
Bitcode | ||
BugPoint | ||
CodeGen | ||
DebugInfo | ||
Demangle | ||
Examples | ||
ExecutionEngine | ||
Feature | ||
FileCheck | ||
Instrumentation | ||
Integer | ||
JitListener | ||
LTO | ||
Linker | ||
MC | ||
MachineVerifier | ||
Object | ||
ObjectYAML | ||
Other | ||
SafepointIRVerifier | ||
Support | ||
SymbolRewriter | ||
TableGen | ||
ThinLTO/X86 | ||
Transforms | ||
Unit | ||
Verifier | ||
YAMLParser | ||
tools | ||
.clang-format | ||
CMakeLists.txt | ||
TestRunner.sh | ||
lit.cfg.py | ||
lit.site.cfg.py.in |