llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.25k stars 11.67k forks source link

False positive: analyzer believes a value is garbage/undefined #28712

Open llvmbot opened 8 years ago

llvmbot commented 8 years ago
Bugzilla Link 28338
Version 3.8
OS Linux
Attachments False positive test case
Reporter LLVM Bugzilla Contributor

Extended Description

When reading an individual byte from a larger value, the static analyzer is fine if: a) reading any byte if the source is a uint32_t b) reading the first byte if the source is a uint32_t[1]

But it falsely reports a problem if reading a subsequent byte from uint32_t[1]

The attached test case demonstrates good (silent) behaviour with VARIANT= 1, 2 and 3. And exposes the false positive with VARIANT=4.

I also tested with clang-3.7 and clang-3.6, so it's not a regression.

llvmbot commented 8 years ago

assigned to @tkremenek