[llvm-bugs] [Bug 44247] New: False positive when analyzing boost/algorithm

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Dec 7 12:55:12 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44247

            Bug ID: 44247
           Summary: False positive when analyzing boost/algorithm
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: mathstuf+llvmbugzilla at gmail.com
                CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org

I got this report via clang-tidy in a Boost header:

/builds/ben.boeckel/smtk/build/../smtk/attribute/Attribute.cxx:234:3: note:
Calling 'split<std::vector<std::__cxx11::basic_string<char>,
std::allocator<std::__cxx11::basic_string<char> > >, const
std::__cxx11::basic_string<char> &,
boost::algorithm::detail::is_any_ofF<char>>'
  boost::split(tree, path, boost::is_any_of(seps));
  ^
/root/misc/root/smtk-deps/include/boost/algorithm/string/split.hpp:161:17:
note: Calling 'token_finder<boost::algorithm::detail::is_any_ofF<char>>'
                ::boost::algorithm::token_finder( Pred, eCompress ) );         
                ^
/root/misc/root/smtk-deps/include/boost/algorithm/string/finder.hpp:219:55:
note: Calling copy constructor for 'is_any_ofF<char>'
            return detail::token_finderF<PredicateT>( Pred, eCompress );
                                                      ^
/root/misc/root/smtk-deps/include/boost/algorithm/string/detail/classification.hpp:114:21:
note: Taking false branch
                    if(use_fixed_storage(m_Size))
                    ^
/root/misc/root/smtk-deps/include/boost/algorithm/string/detail/classification.hpp:123:44:
note: Memory is allocated
                        m_Storage.m_dynSet=new set_value_type[m_Size];
                                           ^
/root/misc/root/smtk-deps/include/boost/algorithm/string/finder.hpp:219:55:
note: Returning from copy constructor for 'is_any_ofF<char>'
            return detail::token_finderF<PredicateT>( Pred, eCompress );
                                                      ^
/root/misc/root/smtk-deps/include/boost/algorithm/string/finder.hpp:219:55:
note: Calling '~is_any_ofF'
/root/misc/root/smtk-deps/include/boost/algorithm/string/detail/classification.hpp:135:51:
note: Left side of '&&' is false
                    if(!use_fixed_storage(m_Size) && m_Storage.m_dynSet!=0)
                                                  ^
/root/misc/root/smtk-deps/include/boost/algorithm/string/detail/classification.hpp:139:17:
note: Potential memory leak
                }
                ^

However, I think this is a false positive. It is assuming that
use_fixed_storage(m_Size) is both false (line 114) and later that
!use_fixed_storage(m_Size) is false (line 135). Marshall in
https://github.com/boostorg/algorithm/issues/63 says it appears like a false
positive. Is this a bug in clang-analyzer or is it actually correct here
somehow?

-- 
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/20191207/ff68dddc/attachment.html>


More information about the llvm-bugs mailing list