[PATCH] [analyzer] Do not reinitialize static globals when the function is called more than once along a path
ganna at apple.com
Wed Feb 6 15:31:10 PST 2013
On Feb 6, 2013, at 3:21 PM, Ted Kremenek <kremenek at apple.com> wrote:
> On Feb 6, 2013, at 3:15 PM, Anna Zaks <ganna at apple.com> wrote:
>> Currently, we reset the static variables with initializers on every visit to the function along a path. The solution might be a bit hacky as we check if the region has been stored something other than a LazyCompoundVal to find out if the static variable has been assigned to previously.
OK. Thanks for the suggestion.
> Hi Anna,
> Why not just record the initialization in a side-table in the GDM? That seems a lot cleaner. This patch seems to rely on all the other pieces working correctly. It also doesn't seem correct. A static variable for an Objective-C pointer is guaranteed to be a valid value (it is zero-initialized), even if we haven't visited the initializer yet. For example:
> static id x; // this is always zero-initialized
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits