[LLVMbugs] [Bug 20798] Analyzer cannot determine std::string empty

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Aug 31 22:42:26 PDT 2014


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

Jani_Lahtinen at mcafee.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #2 from Jani_Lahtinen at mcafee.com ---
No, it is the correct one. The inference path goes so that first you set 'err =
"something"' and then later conclude that 'err.empty() == true'.

  if (args.size() != 1)  // Taking true branch.
    {
      err = "missing arg";   // <= err is now not empty.
    }
...
  if (!err.empty())  // Taking false branch, and therefore err is empty.
    {
      printf("Error: %s\n", err.c_str());
      usage = true;
    }

The point is not that is 'x' uninitialized when we assign it to 'xxx' in the
inference path, but that the path should never reach that because:

  if (usage)   // <== usage should be now true.
    {
      printf("Usage\n");
      return 0;
    }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140901/a2b4aa65/attachment.html>


More information about the llvm-bugs mailing list