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

             Bug #: 13525
           Summary: GTest ASSERT_NO_THROW
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


#include <gtest/gtest.h>

void f(int** i)
{
  *i = new int();
  **i=1;
}

void g(int* ret)
{
  int *i;
  ASSERT_NO_THROW(f(&i));
  //f(&i);                                                                      
  *ret = *i;
}

int main()
{
  int ret;
  g(&ret);
  return ret;
}

gives:

test.cc:21:3: warning: Undefined or garbage value returned to caller
  return ret;
  ^      ~~~
test.cc:14:10: warning: Dereference of undefined pointer value
  *ret = *i;
         ^~
2 warnings generated.

Without the ASSERT_NO_THROW no false positive is reported.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- 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