Jeffrey A Law wrote: > For example, if the only use was inside an unreachable hunk of > code, does that count as a use or not?
Yes, the EDG front-end does this: [EMAIL PROTECTED]:~/tmp$ cat test.cpp void f() { int i; if (0) i = 3; } [EMAIL PROTECTED]:~/tmp$ eccp -A test.cpp "test.cpp", line 2: warning: variable "i" was set but never used int i; ^ (The "SGI Compiler" used to be EDG-based, on IRIX. I don't know whether Kaveh's referring to that version or to the Open64 version, based on the GCC front ends.) (Wouldn't it be easy to emit a warning for this in GCC, in the same optimization-based way we do uninitialized warnings? If there are no paths from the block with the assignment to a use, then the store is useless.) I don't think EDG even builds a CFG. I think they just use some relatively conservative algorithms to produce these sorts of warnings. For this: int i; l: j = i; // j is global if (0) i = 3; goto l; they don't warn on the unintialized use of "i"; they probably treat i as maybe-initialized before reaching j. So, just as you would expect, they are more consistent across the various parameters we've discussed, but less accurate. -- Mark Mitchell CodeSourcery, LLC [EMAIL PROTECTED] (916) 791-8304