This looks great to me. I'll go ahead and commit.
On Jul 14, 2011, at 4:33 PM, Kaelyn Uhrain wrote:
> As reported in PR 10358, code such as:
>
> void foo(int y) {
> int x; // Undefined.
> do {
> y+=x;
> } while (1);
> }
>
> will only trigger a warning about x being uninitialized when
> -Wconditional-uninitialized because the uninitialized variables are
> mistakenly marked as possibly being assigned to before use. The attached
> patch makes a few tiny changes to lib/Analysis/UninitializedValues.cpp to not
> mark uninitialized variables as Initialized just to avoid cascaded warnings.
> Instead it marks them as Unknown (part of the local Value enum) so that
> isUninitialized() will still return false but variables don't accidentally
> get marked as maybe unitialized by calls to CFGBlockValues::mergeIntoScratch
> when they are definitely uninitialized (through it being marked as
> Uninitialized in one packed vector and Initialized in the other, and the two
> values being or'ed together to become MayUninitialized).
>
> The patch also fixes up the four cases in test/Sema/uninit-variables.c where
> a "may be uninitialized" should rightfully be "is uninitialized".
>
> Cheers,
> Kaelyn
> <uninit-var-warning-fix.diff>_______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits