[cfe-dev] path sensitive vs context sensitive

Daniel Marjamäki via cfe-dev cfe-dev at lists.llvm.org
Fri Apr 28 06:09:56 PDT 2017


Hello!

I believe that Clang has "path sensitive" analysis. I wonder why it is not technically "context sensitive"? Clang analyzes function calls.

int div(int x) {
  return 100/x; // <- warning: Division by zero
}

int main() {
  div(0);   // <- change "0" to "10" and no warning is written.
  return 0;
}

What criteria for "context sensitive" is it that clang does not fulfill?

I have always claimed that Cppcheck has context sensitive analysis because it detects such bug. If that is wrong I'd like to know it, and why.

Best regards,
Daniel Marjamäki

..................................................................................................................
Daniel Marjamäki Senior Engineer
Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden

Mobile:                 +46 (0)709 12 42 62
E-mail:                 Daniel.Marjamaki at evidente.se

www.evidente.se



More information about the cfe-dev mailing list