[cfe-dev] Clang SA false positive

Bhargava Shastry via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 19 06:57:43 PDT 2015


Hi Gabor, Daniel,

I see! Thanks for your replies.

On 10/19/2015 03:25 PM, Gábor Horváth wrote:
> cking whether a globally available function can modify the static
> variable sounds like a good idea. I think it might worth a patch, to
> preserve the value in this case.

My two cents: This is equivalent to variable being declared 'static
const.' Clang SA handles this case as expected. While teasing out
'const'ness of a static variable might be helpful, imprecision is
unavoidable. Even if *1* globally accessible function in TU modifies
static variable, Clang SA is going to assume the extern function will
call *that* globally accessible function and flag a warning.

--
Bhargava



More information about the cfe-dev mailing list