llvm / llvm-project

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

Invalid analysis path with bitfields #17912

Open llvmbot opened 10 years ago

llvmbot commented 10 years ago
Bugzilla Link 17538
Version unspecified
OS MacOS X
Attachments Source showing problem
Reporter LLVM Bugzilla Contributor
CC @belkadan

Extended Description

Version 275 of the Mac OS X checker gives an incorrect "null dereference" error on the attached source. Just run "checker-275/scan-build c++ -c invalidpath.cpp" and look at the path it analyzed.

It took a path where retValue.Success was false, but then immediately went down a patch where it was true, which is impossible.

The really weird part is that if you swap the first 2 lines in the "foo" function, the error isn't reported.

Another weirdness is that retValue is initialized in such a way that retValue.Success is true so that the path where it assumed it was false is not possible either.

llvmbot commented 10 years ago

Agreed that's unfortunate. However, I think our codebase uses bitfields quite a bit and I haven't noticed too many analyzer issues relating to them. I hope this can get fixed.

belkadan commented 10 years ago

The analyzer pretty much doesn't handle bitfields at all. sigh

llvmbot commented 10 years ago

assigned to @tkremenek