[PATCH] D139534: [analyzer] Don't escape local static memregions on bind

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 9 09:10:09 PST 2023


steakhal added a comment.

In D139534#4034719 <https://reviews.llvm.org/D139534#4034719>, @xazax.hun wrote:

>> Here is the gist of one *new* TP:
>
> Where would `sprops` get escaped? Did I miss that or was that reduced out of the example?

You are right, it 'never' escapes, yet in the past we modelled all stores to local statics as an 'immediate escape'.
This is what I think we should not do. And this is what this patch removes.

> Overall, this looks like a hard nut to crack. Escaping too much or too little are both problematic, and we don't have the information we need to make the decision. The question is whether we want to make an absolute decision or come up with a heuristic like:
>
>   static int* p;
>   MyStruct reachable(&p);
>   
>   indirect(&reachable);
>   direct(&p);
>
> escaping when `direct` is called, but not escaping when `indirect` is called.
>
> Do you see any patterns in the real-world results that would show a pattern? I am not opposed to making a change, but I wonder if we should start documenting these decisions somewhere that are likely need revision in the future when we have more data.  What do you think?

I've seen only those 3 diffs: 2 new 1 absent issues. But there could be projects which make use of local static variables a lot. It was the case with one of our customers, but I cannot comment on that. I could somehow find open-source projects affected, but I'm not sure if it would be easy unless you have projects in mind.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139534/new/

https://reviews.llvm.org/D139534



More information about the cfe-commits mailing list