aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/UninitializedValues.cpp
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2022-01-07 14:10:57 -0800
committerNick Desaulniers <ndesaulniers@google.com>2022-01-07 14:11:08 -0800
commit3a604fdbcd5fd9ca41f6659692bb4ad2151c3cf4 (patch)
tree93a7e0a052ef6b37283e4d494d2a46e9be1d9a99 /clang/lib/Analysis/UninitializedValues.cpp
parentf38873537bf7e7ef239ffe68b5e5c8b84e0f3758 (diff)
downloadllvm-3a604fdbcd5fd9ca41f6659692bb4ad2151c3cf4.zip
llvm-3a604fdbcd5fd9ca41f6659692bb4ad2151c3cf4.tar.gz
llvm-3a604fdbcd5fd9ca41f6659692bb4ad2151c3cf4.tar.bz2
[Clang][CFG] check children statements of asm goto
When performing CFG based analyses, don't forget to check the child statements of an asm goto, such as the expressions used for inputs+outputs. Fixes: https://github.com/llvm/llvm-project/issues/51024 Fixes: https://github.com/ClangBuiltLinux/linux/issues/1439 Reviewed By: void, jyknight, jyu2, efriedma Differential Revision: https://reviews.llvm.org/D116059
Diffstat (limited to 'clang/lib/Analysis/UninitializedValues.cpp')
-rw-r--r--clang/lib/Analysis/UninitializedValues.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Analysis/UninitializedValues.cpp b/clang/lib/Analysis/UninitializedValues.cpp
index a38ae34..811146e 100644
--- a/clang/lib/Analysis/UninitializedValues.cpp
+++ b/clang/lib/Analysis/UninitializedValues.cpp
@@ -819,12 +819,11 @@ void TransferFunctions::VisitGCCAsmStmt(GCCAsmStmt *as) {
while (const auto *UO = dyn_cast<UnaryOperator>(Ex))
Ex = stripCasts(C, UO->getSubExpr());
+ // Mark the variable as potentially uninitialized for those cases where
+ // it's used on an indirect path, where it's not guaranteed to be
+ // defined.
if (const VarDecl *VD = findVar(Ex).getDecl())
- if (vals[VD] != Initialized)
- // If the variable isn't initialized by the time we get here, then we
- // mark it as potentially uninitialized for those cases where it's used
- // on an indirect path, where it's not guaranteed to be defined.
- vals[VD] = MayUninitialized;
+ vals[VD] = MayUninitialized;
}
}