Skip to content
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

Assertion failure in QualType::getCommonPtr (via clang::ento::MemRegionManager::getElementRegion) #33722

Closed
llvmbot opened this issue Aug 30, 2017 · 6 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla clang:static analyzer

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 30, 2017

Bugzilla Link 34374
Resolution FIXED
Resolved on Sep 25, 2017 12:34
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

$ cat getElementRegion-crash2.cc
typedef struct { int x0; } x1;
struct x2 {
bool x3();
x1 *x4;
int x5;
} * x6;
bool x2::x3() {
x5 = reinterpret_cast<unsigned char >(x6) -
reinterpret_cast<unsigned char >(1);
x1 x7 = x4[0];
x5 + x7.x0;
}
$ clang-tidy -checks=-
,clang-analyzer-
getElementRegion-crash2.cc -- -sdt=c++11
assert.h assertion failed at clang/include/clang/AST/Type.h:628 in const clang::ExtQualsTypeCommonBase *clang::QualType::getCommonPtr() const: !isNull() && "Cannot retrieve a NULL type pointer"
@ 0x544749a __assert_fail
@ 0x5e9285 clang::QualType::getCommonPtr()
@ 0x5dde09 clang::QualType::getCanonicalType()
@ 0x1b6304c clang::ASTContext::getCanonicalType()
@ 0x2dc1122 clang::ento::MemRegionManager::getElementRegion()
@ 0x2e73258 (anonymous namespace)::SimpleSValBuilder::evalBinOpLN()
@ 0x2d2a8ee clang::ento::SValBuilder::evalBinOp()
@ 0x2e74db4 (anonymous namespace)::SimpleSValBuilder::simplifySVal()::Simplifier::VisitSymIntExpr()
@ 0x2e74992 clang::ento::SymExprVisitor<>::Visit()
@ 0x2e746ea (anonymous namespace)::SimpleSValBuilder::simplifySVal()::Simplifier::VisitNonLocSymbolVal()
@ 0x2e7426b clang::ento::SValVisitor<>::Visit()
@ 0x2e7352f (anonymous namespace)::SimpleSValBuilder::simplifySVal()
@ 0x2e709cb (anonymous namespace)::SimpleSValBuilder::evalBinOpNN()
@ 0x2d2abb2 clang::ento::SValBuilder::evalBinOp()
@ 0x2e1d316 clang::ento::ExprEngine::evalBinOp()
@ 0x2e4af60 clang::ento::ExprEngine::VisitBinaryOperator()
@ 0x2e12cdb clang::ento::ExprEngine::Visit()
@ 0x2e0fe44 clang::ento::ExprEngine::ProcessStmt()
@ 0x2e0faca clang::ento::ExprEngine::processCFGElement()
@ 0x2e3dc66 clang::ento::CoreEngine::HandlePostStmt()
@ 0x2e3d566 clang::ento::CoreEngine::dispatchWorkItem()
@ 0x2e3d0a8 clang::ento::CoreEngine::ExecuteWorkList()
@ 0x2138e05 clang::ento::ExprEngine::ExecuteWorkList()
@ 0x20e1802 (anonymous namespace)::AnalysisConsumer::ActionExprEngine()
@ 0x20e15c1 (anonymous namespace)::AnalysisConsumer::RunPathSensitiveChecks()
@ 0x20e1285 (anonymous namespace)::AnalysisConsumer::HandleCode()
@ 0x20d4963 (anonymous namespace)::AnalysisConsumer::HandleDeclsCallGraph()
@ 0x20d2be7 (anonymous namespace)::AnalysisConsumer::HandleTranslationUnit()
@ 0x25136ce clang::MultiplexConsumer::HandleTranslationUnit()

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 30, 2017

assigned to @alexshap

@alexshap
Copy link
Mannequin

alexshap mannequin commented Aug 30, 2017

a bit smaller test:

m.cpp:

bool f(double *p, long x) {
long y = reinterpret_cast<unsigned char *>(p) -
reinterpret_cast<unsigned char *>(1ul);
return y == x;
}

clang --analyze -c m.cpp

i will try to look into this ~soon

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 30, 2017

i will try to look into this ~soon

Thank you!

@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 22, 2017

Alexander, any news here?

@alexshap
Copy link
Mannequin

alexshap mannequin commented Sep 23, 2017

@alexshap
Copy link
Mannequin

alexshap mannequin commented Sep 25, 2017

r314141

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang:static analyzer
Projects
None yet
Development

No branches or pull requests

1 participant