Open
Description
The following program might be considered to be guaranteed to run out of memory, but LLVM actually compiles it in a way that it does not:
int *x = malloc(SIZE_MAX);
int *y = malloc(SIZE_MAX);
if (x && y) {
printf("This is unreachable. I could deref a NULL pointer and this program would still be fine.");
}
It is not clear how to formally justify this.
@JakobDegen also has an example for recursion exhausting memory via stack allocations and being similarly optimized away.
Metadata
Metadata
Assignees
Labels
No labels