[LLVMbugs] [Bug 13525] New: GTest ASSERT_NO_THROW

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Aug 4 15:39:10 PDT 2012


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: kremenek at apple.com
        ReportedBy: roland at utk.edu
                CC: llvmbugs at cs.uiuc.edu
    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.



More information about the llvm-bugs mailing list