llvm / llvm-project

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

False positive on dereference of null pointer warning #15538

Open llvmbot opened 11 years ago

llvmbot commented 11 years ago
Bugzilla Link 15166
Version unspecified
OS MacOS X
Reporter LLVM Bugzilla Contributor
CC @belkadan

Extended Description

Using the static analyzer from the checker-270 build for MacOSX on the following C++ source:

============================ void set_x(void *&);

int foo(void) { int *x = 0;

set_x((void *&)x);
return *x;

}

results in:

warning: Dereference of null pointer (loaded from variable 'x')

This doesn't happen if the "void" is replaced by "int".

llvmbot commented 11 years ago

I agree it's likely rare, but it's used in Intel's Graphics driver.

belkadan commented 11 years ago

Thanks for the full bug report. Tracked in rdar://problem/11630894.

I will note that this use case is fairly rare and so it's not a high priority right now. Sorry!

llvmbot commented 11 years ago

assigned to @tkremenek