Can analysis detect undefined expressions?

Christopher R Volpe volpe at camelback.crd.ge.com
Fri Jun 14 22:48:44 AEST 1991


In article <1991Jun13.231924.3711 at ism.isc.com>,
willcr at bud.sos.ivy.isc.com (Will Crowder) writes:
|>I'm not sure if it has been proven impossible, and indeed, trivial and
|>obvious violations like "i = i++ + i++" are easy to spot.  However,
|>how would you deal with the case of:
|>
|>   i = (*p)++ + (*q)++;
|>
|>I mean, this statement is perfectly legal and its value defined if
|>p != q.  However, if p == q, then you're once again in deep yogurt as you're
|>modifying the same object twice without an intervening sequence point.
|>
|>I don't know statistics well enough to put this as eloquently as I'd like,
|>but:
|>
|>Determining at compile time of p could ever be equal to q would require
|>exhaustive code path analysis, and this analysis has been shown to take
|>longer than the estimated remaining lifespan of the galaxy for anything
|>over a few lines.  (I can't remember that great quote I heard about it,
|>or I'd put it in my .sig.)

It's not just time consuming, it's theoretically impossible for an
arbitrary program. It's trivial to reduce the halting problem to
this problem, thus showing its undecidability. 
                                       
==================
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com



More information about the Comp.lang.c mailing list