[PATCH] D125400: [clang][Analyzer] Add errno state to standard functions modeling.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 07:08:00 PDT 2022


balazske added a comment.

Function `mkdir` is modeled incorrectly by the checker. According to the man page it can return 0 or -1 only (-1 is error) but the checker allows non-negative value at success. So the shown bug report is incorrect (it can be only -1 if not 0 and then check of `errno` is allowed). Anyway the note tags should be added to every function.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1697
+            .Case(ReturnsValidFileDescriptor, ErrnoMustNotBeChecked, "OK")
+            .Case(ReturnsMinusOne, ErrnoNEZeroIrrelevant, "'dup2' failed")
             .ArgConstraint(ArgumentCondition(0, WithinRange, Range(0, IntMax)))
----------------
These strings are for test purposes only.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125400/new/

https://reviews.llvm.org/D125400



More information about the cfe-commits mailing list