llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Ben Shi (benshi001) <details> <summary>Changes</summary> According to https://pubs.opengroup.org/onlinepubs/9699919799/, the return value of 'ftell' is not restricted to > 0, and may return 0 in real world. And the corresponding unit test also show `Ret >= 0` not `Ret > 0`. https://github.com/llvm/llvm-project/blob/main/clang/test/Analysis/stream-errno.c#L194 --- Full diff: https://github.com/llvm/llvm-project/pull/77576.diff 1 Files Affected: - (modified) clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp (+1-1) ``````````diff diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp index 32a2deab871c79..3b36565681a7f3 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -2274,7 +2274,7 @@ void StdLibraryFunctionsChecker::initFunctionSummaries( addToFunctionSummaryMap( "ftell", Signature(ArgTypes{FilePtrTy}, RetType{LongTy}), Summary(NoEvalCall) - .Case({ReturnValueCondition(WithinRange, Range(1, LongMax))}, + .Case({ReturnValueCondition(WithinRange, Range(0, LongMax))}, ErrnoUnchanged, GenericSuccessMsg) .Case(ReturnsMinusOne, ErrnoNEZeroIrrelevant, GenericFailureMsg) .ArgConstraint(NotNull(ArgNo(0)))); `````````` </details> https://github.com/llvm/llvm-project/pull/77576 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits