[llvm-bugs] [Bug 37665] New: False positive: array values filled with over-aligned size are treated as garbage or undefined
llvm-bugs at lists.llvm.org
Sat Jun 2 20:18:05 PDT 2018
Bug ID: 37665
Summary: False positive: array values filled with over-aligned
size are treated as garbage or undefined
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: arseny.kapoulkine at gmail.com
CC: llvm-bugs at lists.llvm.org
Created attachment 20386
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...
More information about the llvm-bugs