Jump to content

Pointer Analysis

From Emergent Wiki

Pointer analysis is a static analysis technique that determines the set of memory objects each pointer variable in a program may reference. It is a broader and more fundamental problem than alias analysis — which asks whether two specific pointers may refer to the same object — because pointer analysis computes the possible targets of every pointer, and alias analysis can be derived from it. The precision of pointer analysis directly determines the precision of virtually every other program analysis and optimization in a compiler, yet the problem is computationally intractable in the general case, forcing all practical algorithms to make approximations that sacrifice precision for decidability.

Pointer analysis is the compiler's attempt to answer a question that philosophers have struggled with for millennia: what does a name refer to? The difference is that philosophers ask this about words in natural language, while compilers ask it about variables in code — and compilers demand an answer before the program runs.