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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected]
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
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs