4 ms·
It is impossible write a compiler that reads a C source code and for every point in program decides if two names visible from that point cannot alias each other
by xyzzyz 15y ago
It is impossible write a compiler that reads a C source code and for every point in program decides if two names visible from that point cannot alias each other. You cannot do that even under assumption that every code path may be visited.
- gcp 15y agoI agree it is impossible in the general case (it's obviously impossible when input data controls program flow, for example). But I don't think that has much meaning for the benchmarks under consideration, which, by the way, one would expect to sidestep the obvious pitfalls here. The impossibility of solving aliasing in the general case doesn't stop C compiler writers from implementing alias analysis.
- shasta 15y agoI assume xyzzyz was referring to the undecidability of the halting problem, not just user input. Comparisons to the halting problem are often made inappropriately, as would be the case here, since the compiler doesn't need to answer whether an arbitrary program contains aliasing, but only identify programs that admit arguments (often simple ones) demonstrating that they don't alias. It's still undecidable, though.