From owner-svn-src-all@FreeBSD.ORG Fri Apr 3 18:42:39 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE02C394; Fri, 3 Apr 2015 18:42:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9E93815B; Fri, 3 Apr 2015 18:42:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t33Igdgn018406; Fri, 3 Apr 2015 18:42:39 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t33IgdYf018405; Fri, 3 Apr 2015 18:42:39 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201504031842.t33IgdYf018405@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 3 Apr 2015 18:42:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281047 - head/contrib/llvm/patches X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Apr 2015 18:42:39 -0000 Author: dim Date: Fri Apr 3 18:42:38 2015 New Revision: 281047 URL: https://svnweb.freebsd.org/changeset/base/281047 Log: Add clang patch corresponding to r281046. Added: head/contrib/llvm/patches/patch-12-clang-r227115-constantarraytype.diff Added: head/contrib/llvm/patches/patch-12-clang-r227115-constantarraytype.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/llvm/patches/patch-12-clang-r227115-constantarraytype.diff Fri Apr 3 18:42:38 2015 (r281047) @@ -0,0 +1,50 @@ +Pull in r227115 from upstream clang trunk (by Ben Langmuir): + + Fix assert instantiating string init of static variable + + ... when the variable's type is a typedef of a ConstantArrayType. Just + look through the typedef (and any other sugar). We only use the + constant array type here to get the element count. + +This fixes an assertion failure when building the games/redeclipse port. + +Introduced here: http://svnweb.freebsd.org/changeset/base/281046 + +Index: tools/clang/lib/Sema/SemaInit.cpp +=================================================================== +--- tools/clang/lib/Sema/SemaInit.cpp ++++ tools/clang/lib/Sema/SemaInit.cpp +@@ -149,10 +149,10 @@ static void updateStringLiteralType(Expr *E, QualT + static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT, + Sema &S) { + // Get the length of the string as parsed. +- uint64_t StrLength = +- cast(Str->getType())->getSize().getZExtValue(); ++ auto *ConstantArrayTy = ++ cast(Str->getType()->getUnqualifiedDesugaredType()); ++ uint64_t StrLength = ConstantArrayTy->getSize().getZExtValue(); + +- + if (const IncompleteArrayType *IAT = dyn_cast(AT)) { + // C99 6.7.8p14. We have an array of character type with unknown size + // being initialized to a string literal. +Index: tools/clang/test/SemaTemplate/instantiate-static-var.cpp +=================================================================== +--- tools/clang/test/SemaTemplate/instantiate-static-var.cpp ++++ tools/clang/test/SemaTemplate/instantiate-static-var.cpp +@@ -114,3 +114,15 @@ namespace PR6449 { + template class X1; + + } ++ ++typedef char MyString[100]; ++template ++struct StaticVarWithTypedefString { ++ static MyString str; ++}; ++template ++MyString StaticVarWithTypedefString::str = ""; ++ ++void testStaticVarWithTypedefString() { ++ (void)StaticVarWithTypedefString::str; ++}