[cfe-commits] r41853 - /cfe/trunk/Analysis/DeadStores.cpp

Ted Kremenek kremenek at apple.com
Tue Sep 11 10:42:24 PDT 2007

On Sep 11, 2007, at 10:33 AM, Fariborz Jahanian wrote:

> On Sep 11, 2007, at 10:24 AM, Ted Kremenek wrote:
>> Author: kremenek
>> Date: Tue Sep 11 12:24:14 2007
>> New Revision: 41853
>> URL: http://llvm.org/viewvc/llvm-project?rev=41853&view=rev
>> Log:
>> For looking at "dead stores" in declarations, we now check to see
>> if the assigned value is a constant expression, e.g.:
> Don't you want to check that RHS is an expression with no side- 
> effect (or maybe this is what you mean by a constant expression)?
> - Fariborz

I think we still want to flag cases such as the following as an error:

int x = y;
x = ...

In this case, the assignment to "x" in the declaration has no side- 
effects, but it is (in my opinion) not clear evidence of defensive  
programming.  I'm willing to discuss this; this is just a heuristic to  
prune false positives.

By declarations using constant expressions as the RHS, I am referring  
to cases like:

int x = 0;
int y = 1+2*20;

More information about the cfe-commits mailing list