llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Slow compound value binding with C99 designated initializers.

Open haoNoQ opened this issue 4 years ago • 1 comments

https://discourse.llvm.org/t/enormously-huge-analysis-time/60969

The following code takes 30+ minutes to --analyze:

extern int f (const char *);

int g (int x) {
  char *v[] = {
    [0] = "",
    [1234] = "aaaa",
    [123456] = "bbbb",
  };

  return x < 0 ? -1 : f (v[x]);
}

Looks like we're trying to create a symbolic array of 123456 elements and explicitly write down each element, and then expand it into separate RegionStore bindings element-by-element. The analysis assumes that if elements are explicitly written down, there's few of them so explicitly writing them down doesn't hurt. The C99 designated initializer syntax used here suggests otherwise.

haoNoQ avatar Mar 15 '22 19:03 haoNoQ

@llvm/issue-subscribers-clang-static-analyzer

llvmbot avatar Mar 15 '22 19:03 llvmbot