-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Closed
Labels
clang:dataflowClang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.htmlClang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html
Description
A number of (likely-related) simple loops cause the analysis to fail to converge. Below are a series of examples reduced from real code. I suspect they are all the same problem:
TEST(PointerNullabilityTest, NonConvergeBools1) {
EXPECT_TRUE(checkDiagnostics(R"cc(
bool cond();
void target() {
bool a = false;
bool b = cond();
while (!a || !b) {
if (!cond()) return;
if (cond()) {
if (a) return;
a = cond();
} else {
if (b) return;
b = true;
}
}
}
)cc"));
}
TEST(PointerNullabilityTest, NonConvergeBools2) {
EXPECT_TRUE(checkDiagnostics(R"cc(
bool cond();
void target() {
bool c = false;
while (cond() || cond()) {
c = (3 == 4);
}
}
)cc"));
}
TEST(PointerNullabilityTest, NonConvergeBools3) {
EXPECT_TRUE(checkDiagnostics(R"cc(
bool cond();
void target() {
if (cond())
;
while (cond() || cond())
;
}
)cc"));
}
TEST(PointerNullabilityTest, NonConvergeBools4) {
EXPECT_TRUE(checkDiagnostics(R"cc(
bool cond();
void target(int m, int n, bool b) {
bool g = m == 0 ;
while (cond() || cond() || g) {
bool c = m == 0 ;
g = false;
}
}
)cc"));
}
Metadata
Metadata
Assignees
Labels
clang:dataflowClang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.htmlClang Dataflow Analysis framework - https://clang.llvm.org/docs/DataFlowAnalysisIntro.html