https://bugs.llvm.org/show_bug.cgi?id=52134
Bug ID: 52134
Summary: The result of malloc(-1) is not as expected
Product: clang
Version: 8.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: 499537...@qq.com
CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
neeil...@live.com, richard-l...@metafoo.co.uk
test as:
int main(void) {
void *p;
p = malloc (-1);
if (p != NULL) {
return 1;
}
return 0;
}
$clang test.c -O2 && ./a.out
It's always return 1, but as we know p is null as expected?
No matter how much memory is malloced, it's always true.
Inst Combiner replace %cmp = icmp ne i8* @malloc(i32 -1)
with i1 true directly.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs