3 ms·
I wonder what the point of the first optimization in this specific case was. Why is LLVM replacing iq with ip in the body? I'm not questioning why it should be
by tsimionescu 6y ago
I wonder what the point of the first optimization in this specific case was. Why is LLVM replacing iq with ip in the body? I'm not questioning why it should be allowed to, but I don't understand why it would do it in this particular case.
I also don't understand why that optimization is necessary to surface the problem.
If we simply had a program that was doing
char p[1], q[1] = {0};
uintptr_t ip = (uintptr_t)(p+1);
*(char*)ip = 10;
print(q[0]);
Wouldn't applying just optimizations 2 and 3 on this code surface the same bug as discussed in the article?