r243644 - Fix sanitizer fallout from r243642

Ulrich Weigand ulrich.weigand at de.ibm.com
Thu Jul 30 08:53:58 PDT 2015

Author: uweigand
Date: Thu Jul 30 10:53:58 2015
New Revision: 243644

URL: http://llvm.org/viewvc/llvm-project?rev=243644&view=rev
Fix sanitizer fallout from r243642

The memory-sanitizer build bot reported:

==5574== WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f03089e15f6 in
clang::SourceLocation, char const*&, unsigned int&, bool&)

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.


Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=243644&r1=243643&r2=243644&view=diff
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Thu Jul 30 10:53:58 2015
@@ -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");

More information about the cfe-commits mailing list