Issue 135050
Summary On x86-64 trunk, `-Wconditional-uninitialized` false positive in a "simple" case
Labels false-positive
Assignees
Reporter blanefrye
    `-Wconditional-uninitialized` claims `c` may be uninitialized when used in `if (c)`, but if it's used `b` must be true, meaning `b` must not be false, meaning `c` must have been assigned `false`.

https://godbolt.org/z/PzdeMq84M

```
void test(bool a) 
{
    bool b = true;
    bool c;

    if (a)
    {
        c = false;
    }
    else
    {
        b = false;
    }

    if (b)
 {
        if (c)
        {

        }  
    }
}
```

I see as of 2018, "-Wconditional-uninitialized is expected to have false positives: it warns in cases where a simple control flow analysis cannot prove that a variable was written to prior to each use." but I'm not sure what qualifies as "simple". https://bugs.llvm.org/show_bug.cgi?id=38856
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to