martong added inline comments.
================ Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:313-321 for (size_t I = 1; I != E; ++I) { const llvm::APSInt &Min = BVF.getValue(R[I - 1].second + 1ULL, T); const llvm::APSInt &Max = BVF.getValue(R[I].first - 1ULL, T); - assert(Min <= Max); - State = CM.assumeInclusiveRange(State, *N, Min, Max, false); - if (!State) - return nullptr; + if (Min <= Max) { + State = CM.assumeInclusiveRange(State, *N, Min, Max, false); + if (!State) + return nullptr; ---------------- Szelethus wrote: > I appreciated you sitting down with me with a piece of paper and a pen to > explain what happens here, but for the less fortunate this code snippet > should be decorated with some ASCII art. > > I don't insist on you doing that within the scope of this patch, but if you > did anyways, that would be great :) Ok, I have added that below the existing comment of the enclosing `if` block. ================ Comment at: clang/lib/StaticAnalyzer/Core/CheckerHelpers.cpp:138 + llvm::APInt IntValue; + constexpr unsigned AutoSenseRadix = 0; + if (ValueStr.getAsInteger(AutoSenseRadix, IntValue)) ---------------- Szelethus wrote: > TIL Despite the analyzer having a half-a-decade old checker option that was > defaulted to a hexadecimal value, nobody wrote tests for it, and it took 4-5 > years to unearth that due to the incorrect parsing of integers (it was set to > decimal instead of auto detect) it never ever worked. Well, I hope AutoSenseRadix will just detect the correct base. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D74473/new/ https://reviews.llvm.org/D74473 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits