================
@@ -235,6 +242,19 @@ void testStrlenCallee(void) {
   clang_analyzer_eval(lenBefore == lenAfter); // expected-warning{{UNKNOWN}}
 }
 
+void strlen_symbolic_offset(unsigned x) {
+  const char *str = "abcd";
+  if (x > 3)
+    return;
+  // FIXME: these should be known
----------------
NagyDonat wrote:

If `x` is `unsigned` and `(x > 3)` is false, then the possible values of `x` 
are $\lbrace 0,1,2,3\rbrace$, so the possible values of `strlen(str + x)` are 
$\lbrace4,3,2,1\rbrace$ -- therefore `UNKNOWN` is the correct result for most 
of these checks (the only real FIXME is that `strlen(str + x) <= 4` should be 
true).

https://github.com/llvm/llvm-project/pull/159795
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to