[llvm-bugs] [Bug 32235] New: Analyzer: locale_facets.tcc false positive "Assigned value is garbage or undefined"
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Mar 10 14:50:47 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=32235
Bug ID: 32235
Summary: Analyzer: locale_facets.tcc false positive "Assigned
value is garbage or undefined"
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: marshallk at google.com
CC: llvm-bugs at lists.llvm.org
Getting buffer overrun analysis errors like this one for simple ostream log
statements such as this one: "DPLOG(ERROR) << "Unable to terminate process " <<
process_;"
LLVM version: clang version 5.0.0 (trunk 296321)
Platform: Linux; target: Linux
Code:
https://cs.chromium.org/chromium/src/base/process/process_posix.cc?rcl=2749492d345c9b4fe350a9b94ed34dd5170c4f81&l=352
[67/20605] CXX obj/base/base/process_posix.o
In file included from ../../base/process/process_posix.cc:5:
In file included from ../../base/process/process.h:10:
In file included from ../../base/process/process_handle.h:12:
In file included from ../../base/files/file_path.h:113:
In file included from ../../base/containers/hash_tables.h:13:
In file included from ../../base/hash.h:16:
In file included from ../../base/logging.h:12:
In file included from
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/sstream:39:
In file included from
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/istream:40:
In file included from
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/ios:45:
In file included from
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_ios.h:39:
In file included from
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.h:2608:
In file included from
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/ios:45:
In file included from
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/basic_ios.h:39:
In file included from
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.h:2608:
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1258:9:
warning: Assigned value is garbage or undefined
*__s++ = *__first++;
^
../../base/process/process_posix.cc:309:17: note: Assuming the condition is
false
bool result = kill(process_, SIGTERM) == 0;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../base/process/process_posix.cc:310:14: note: Left side of '&&' is false
if (result && wait) {
^
../../base/process/process_posix.cc:351:3: note: Taking true branch
if (!result)
^
../../base/process/process_posix.cc:352:5: note: Assuming the condition is
false
DPLOG(ERROR) << "Unable to terminate process " << process_;
^~~~~~~~~~~~
../../base/logging.h:777:3: note: expanded from macro 'DPLOG'
LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../base/logging.h:402:3: note: expanded from macro 'LAZY_STREAM'
!(condition) ? (void) 0 : ::logging::LogMessageVoidify() & (stream)
^~~~~~~~~~~~
../../base/process/process_posix.cc:352:5: note: '?' condition is false
../../base/logging.h:777:3: note: expanded from macro 'DPLOG'
LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity))
^
../../base/logging.h:402:3: note: expanded from macro 'LAZY_STREAM'
!(condition) ? (void) 0 : ::logging::LogMessageVoidify() & (stream)
^
../../base/process/process_posix.cc:352:5: note: Calling
'basic_ostream::operator<<'
DPLOG(ERROR) << "Unable to terminate process " << process_;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../base/logging.h:777:3: note: expanded from macro 'DPLOG'
LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity))
^
../../base/logging.h:402:62: note: expanded from macro 'LAZY_STREAM'
!(condition) ? (void) 0 : ::logging::LogMessageVoidify() & (stream)
^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:113:11:
note: Assuming '__fmt' is not equal to 'oct'
if (__fmt == ios_base::oct || __fmt == ios_base::hex)
^~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:113:11:
note: Left side of '||' is false
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:113:37:
note: Assuming '__fmt' is not equal to 'hex'
if (__fmt == ios_base::oct || __fmt == ios_base::hex)
^~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:113:7:
note: Taking false branch
if (__fmt == ios_base::oct || __fmt == ios_base::hex)
^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:116:9:
note: Calling 'basic_ostream::_M_insert'
return _M_insert(static_cast<long>(__n));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:69:2:
note: Taking true branch
if (__cerb)
^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/ostream.tcc:75:7:
note: Calling 'num_put::put'
if (__np.put(*this, *this, this->fill(), __v).failed())
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.h:2336:16:
note: Calling 'num_put::do_put'
{ return this->do_put(__s, __f, __fill, __v); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.h:2475:16:
note: Calling 'num_put::_M_insert_int'
{ return _M_insert_int(__s, __io, __fill, __v); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:868:22:
note: Assuming '__basefield' is equal to 'oct'
const bool __dec = (__basefield != ios_base::oct
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:869:8:
note: Left side of '&&' is false
&& __basefield != ios_base::hex);
^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:870:40:
note: Left side of '||' is true
const __unsigned_type __u = ((__v > 0 || !__dec)
^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:877:6:
note: Assuming the condition is true
if (__lc->_M_use_grouping)
^~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:877:2:
note: Taking true branch
if (__lc->_M_use_grouping)
^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:884:6:
note: Calling 'num_put::_M_group_int'
_M_group_int(__lc->_M_grouping, __lc->_M_grouping_size,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:839:21:
note: Calling '__add_grouping'
_CharT* __p = std::__add_grouping(__new, __sep, __grouping,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1249:14:
note: Assuming the condition is true
while (__last - __first > __gbeg[__idx]
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1249:14:
note: Left side of '&&' is true
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1250:10:
note: Assuming the condition is true
&& static_cast<signed char>(__gbeg[__idx]) > 0
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1249:14:
note: Left side of '&&' is true
while (__last - __first > __gbeg[__idx]
^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1249:7:
note: Loop condition is true. Entering loop body
while (__last - __first > __gbeg[__idx]
^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1254:4:
note: Assuming the condition is false
__idx < __gsize - 1 ? ++__idx : ++__ctr;
^~~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1254:4:
note: '?' condition is false
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1250:7:
note: Left side of '&&' is false
&& static_cast<signed char>(__gbeg[__idx]) > 0
^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1257:7:
note: Loop condition is true. Entering loop body
while (__first != __last)
^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1257:7:
note: Loop condition is true. Entering loop body
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1257:7:
note: Loop condition is true. Entering loop body
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1257:7:
note: Loop condition is true. Entering loop body
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/locale_facets.tcc:1258:9:
note: Assigned value is garbage or undefined
*__s++ = *__first++;
^ ~~~~~~~~~~
1 warning generated.
--
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/20170310/aac23db4/attachment-0001.html>
More information about the llvm-bugs
mailing list