Index: lib/AST/ASTDiagnostic.cpp =================================================================== --- lib/AST/ASTDiagnostic.cpp +++ lib/AST/ASTDiagnostic.cpp @@ -1683,7 +1683,7 @@ ToName = ToTD->getQualifiedNameAsString(); } - if (Same) { + if (Same && FromTD) { OS << "template " << FromTD->getNameAsString(); } else if (!PrintTree) { OS << (FromDefault ? "(default) template " : "template "); Index: lib/AST/NestedNameSpecifier.cpp =================================================================== --- lib/AST/NestedNameSpecifier.cpp +++ lib/AST/NestedNameSpecifier.cpp @@ -456,7 +456,9 @@ Buffer = NewBuffer; BufferCapacity = NewCapacity; } - + + assert(Buffer && "Buffer cannot be NULL"); + memcpy(Buffer + BufferSize, Start, End - Start); BufferSize += End-Start; } Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2339,7 +2339,7 @@ success = getAArch64MicroArchFeaturesFromMcpu(D, getAArch64TargetCPU(Args), Args, Features); - if (!success) + if (!success && A) D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args); if (Args.getLastArg(options::OPT_mgeneral_regs_only)) { Index: lib/Sema/SemaInit.cpp =================================================================== --- lib/Sema/SemaInit.cpp +++ lib/Sema/SemaInit.cpp @@ -4862,6 +4862,8 @@ InitializationSequence &Sequence, const InitializedEntity &Entity, Expr *Initializer) { + assert(Initializer && "Initializer needs to be not NULL"); + bool ArrayDecay = false; QualType ArgType = Initializer->getType(); QualType ArgPointee; @@ -5237,11 +5239,11 @@ DeclAccessPair dap; if (isLibstdcxxPointerReturnFalseHack(S, Entity, Initializer)) { AddZeroInitializationStep(Entity.getType()); - } else if (Initializer->getType() == Context.OverloadTy && + } else if (Initializer && Initializer->getType() == Context.OverloadTy && !S.ResolveAddressOfOverloadedFunction(Initializer, DestType, false, dap)) SetFailed(InitializationSequence::FK_AddressOfOverloadFailed); - else if (Initializer->getType()->isFunctionType() && + else if (Initializer && Initializer->getType()->isFunctionType() && isExprAnUnaddressableFunction(S, Initializer)) SetFailed(InitializationSequence::FK_AddressOfUnaddressableFunction); else