]> granicus.if.org Git - clang/commitdiff
Fix sanitizer fallout from r243642
authorUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 30 Jul 2015 15:53:58 +0000 (15:53 +0000)
committerUlrich Weigand <ulrich.weigand@de.ibm.com>
Thu, 30 Jul 2015 15:53:58 +0000 (15:53 +0000)
The memory-sanitizer build bot reported:

==5574== WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f03089e15f6 in
clang::Parser::TryAltiVecTokenOutOfLine(clang::DeclSpec&,
clang::SourceLocation, char const*&, unsigned int&, bool&)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDecl.cpp:6290:11

This is because the "Ident_pixel" variable was uninitialized
in the getLangOpts().ZVector case, but we'd still call into
clang::Parser::TryAltiVecTokenOutOfLine, which uses the variable.

The simplest fix for this without sprinkling !getLangOpts().ZVector
checks all over the code seems to be to just initialize the variable
to nullptr; this will then do the right thing on ZVector.

Checked in to unbreak the build bots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243644 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/Parser.cpp

index 9716771efc42d41f8ec86be0683d8a311d341a73..0acd828d7c1302fd5c9442d43821be91402cdd30 100644 (file)
@@ -476,6 +476,9 @@ void Parser::Initialize() {
 
   Ident_super = &PP.getIdentifierTable().get("super");
 
+  Ident_vector = nullptr;
+  Ident_bool = nullptr;
+  Ident_pixel = nullptr;
   if (getLangOpts().AltiVec || getLangOpts().ZVector) {
     Ident_vector = &PP.getIdentifierTable().get("vector");
     Ident_bool = &PP.getIdentifierTable().get("bool");