-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[analyzer] Crashes when analyzing a call to a user-defined function named strerror
#88181
Comments
@llvm/issue-subscribers-clang-static-analyzer Author: Ilya A. Kriveshko (iillyyaa)
Use of a function named `strerror` in a private namespace causes clang-tidy to crash.
If the function is renamed to anything else (e.g. `strerrorX`) the crash disappears.
Minimal program that shows this issue: #include <string>
namespace other {
std::string strerror(int errnum);
void test() {
(void)strerror(0);
}
} // namespace other Running this through clang-tidy in LLVM 18.1.2 leads to:
Note that this stack trace was produced when compiling exactly the minimal example in place of the original source that exhibited the issue. However, the same issue is currently also reproducible in clang-tidy (trunk) on godbolt.org: https://godbolt.org/z/93Tqv4n8x As an explanatory aside: our project uses a thread-safe wrapper for |
strerror
strerror
Fixes llvm#88181 (cherry picked from commit e096c14)
Fixes llvm#88181 (cherry picked from commit e096c14)
This commit deletes the "simple" constructor of `CallDescription` which did not require a `CallDescription::Mode` argument and always used the "wildcard" mode `CDM::Unspecified`. A few months ago, this vague matching mode was used by many checkers, which caused bugs like llvm#81597 and llvm#88181. Since then, my commits improved the available matching modes and ensured that all checkers explicitly specify the right matching mode. After those commits, the only remaining references to the "simple" constructor were some unit tests; this commit updates them to use an explicitly specified matching mode (often `CDM::SimpleFunc`). The mode `CDM::Unspecified` was not deleted in this commit because it's still a reasonable choice in `GenericTaintChecker` and a few unit tests.
…92454) This commit deletes the "simple" constructor of `CallDescription` which did not require a `CallDescription::Mode` argument and always used the "wildcard" mode `CDM::Unspecified`. A few months ago, this vague matching mode was used by many checkers, which caused bugs like #81597 and #88181. Since then, my commits improved the available matching modes and ensured that all checkers explicitly specify the right matching mode. After those commits, the only remaining references to the "simple" constructor were some unit tests; this commit updates them to use an explicitly specified matching mode (often `CDM::SimpleFunc`). The mode `CDM::Unspecified` was not deleted in this commit because it's still a reasonable choice in `GenericTaintChecker` and a few unit tests.
Fixes llvm#88181 (cherry picked from commit e096c14)
Fixes llvm#88181 (cherry picked from commit e096c14)
Fixes llvm#88181 (cherry picked from commit e096c14)
Fixes llvm#88181 (cherry picked from commit e096c14)
Use of a function named
strerror
in a private namespace causes clang-tidy to crash.If the function is renamed to anything else (e.g.
strerrorX
) the crash disappears.Minimal program that shows this issue:
Running this through clang-tidy in LLVM 18.1.2 leads to:
Note that this stack trace was produced when compiling exactly the minimal example in place of the original source that exhibited the issue. However, the same issue is currently also reproducible in clang-tidy (trunk) on godbolt.org:
https://godbolt.org/z/93Tqv4n8x
As an explanatory aside: our project uses a thread-safe wrapper for
strerror
in a custom namespace that is implemented in terms ofstd::generic_category().message(errnum)
to appeaseconcurrency-mt-unsafe
check.The text was updated successfully, but these errors were encountered: