http://llvm.org/bugs/show_bug.cgi?id=17948

            Bug ID: 17948
           Summary: False positive: Value stored is never read
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

This code triggers a warning:
> clang-problems.cpp:, Clang (LLVM based), Priority: Normal
> Value stored to 'i' is never read. 
Value is read in another thread.

>>
struct Test
{
public:
    Test(bool& i_bool)
        : the_bool(i_bool)
    {}

    void
    run()
    {
        while(the_bool);
    }
    bool& the_bool;
};

void
schedule_test(Test* t)
{
    // puts it on a queue that is handled in another thread
    (void)t;
}

void f()
{
    bool i = false;
    Test* t = new Test(i);
    schedule_test(t);
    i = true;
    // wait for threadpool to become empty
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to