NoQ added a comment.

Nice catch!

Now, this needs a test. How about this one:

  // enable the debug.ExprInspection checker?
  void clang_analyzer_eval(int);
  
  void test_asume_after_access(unsigned long x) {
    char buf[100];
    buf[x] = 1;
    clang_analyzer_eval(x <= 99); // expected-warning{{TRUE}}
  }

By the way, if we replace `char` with `int`, this test fails even with your 
patch. The reason is, the assumption is added on `(4 * x)` rather than on `x`, 
and the constraint manager explodes. Does anybody volunteer to fix this (eg. on 
the checker side - throw easier equations at the solver)?


https://reviews.llvm.org/D23112



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to