[llvm-bugs] [Bug 37665] New: False positive: array values filled with over-aligned size are treated as garbage or undefined
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Jun 2 20:18:05 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37665
Bug ID: 37665
Summary: False positive: array values filled with over-aligned
size are treated as garbage or undefined
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: arseny.kapoulkine at gmail.com
CC: llvm-bugs at lists.llvm.org
Created attachment 20386
--> https://bugs.llvm.org/attachment.cgi?id=20386&action=edit
minimal repro
Given a function, that takes size_t count and fills a local array with count
values and then reads count values from the array, everything works well.
When instead we use the following expression to align count upwards:
size_t aligned_count = (count + 15) & ~15;
And fill aligned_count elements instead, static analyzer thinks that elements
read from the array could be uninitialized. This doesn't seem to be due to
count possibly overflowing since removing "& ~15" removes the error.
Adding assert(aligned_count >= count); doesn't seem to fix this :(
Reproducer online: https://godbolt.org/g/55vJQ6
--
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/20180603/db2600e1/attachment-0001.html>
More information about the llvm-bugs
mailing list