-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Description
bool cond();
void foo() {
for (; cond();) {
int obj;
int* view;
if (cond()) {
view = &obj;
}
(void)*view; // error: use-after-scope.
}
}https://godbolt.org/z/MvrdMaKK4
My idea to fix this is to issue a Kill/Reset when process the DeclStmt. The problem currently is that decl int* view; does not kill the original value from the last iteration.
We can choose to have this warning as this is otherwise a use-of-uninitialised value
Metadata
Metadata
Assignees
Labels
clang:temporal-safetyIssue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)Issue/FR relating to the lifetime analysis in Clang (-Wdangling, -Wreturn-local-addr)
Type
Projects
Status
No status