Hi, could commit r168112 be please merged into the release 3.2 branch. It fixes a compiler crash when using incomplete types, e.g. when using the boost C++ library, see bugs 12774, 13156, 13460, 14355. I added the commit contents below.
Thanks, Benjamin PS: I couldn't reply to the corresponding commit message as I wasn't subscribed to the list at that time. --- Author: efriedma Date: Thu Nov 15 17:40:48 2012 New Revision: 168112 URL: http://llvm.org/viewvc/llvm-project?rev=168112&view=rev Log: Make sure CodeGenTypes correctly reconverts function types. Fixes PR14355, a crash in IR generation. Added: cfe/trunk/test/CodeGen/incomplete-function-type-2.c Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=168112&r1=168111&r2=168112&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original) +++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Thu Nov 15 17:40:48 2012 @@ -453,9 +453,19 @@ // cannot lower the function type. if (!isFuncTypeConvertible(FT)) { // This function's type depends on an incomplete tag type. + + // Force conversion of all the relevant record types, to make sure + // we re-convert the FunctionType when appropriate. + if (const RecordType *RT = FT->getResultType()->getAs<RecordType>()) + ConvertRecordDeclType(RT->getDecl()); + if (const FunctionProtoType *FPT = dyn_cast<FunctionProtoType>(FT)) + for (unsigned i = 0, e = FPT->getNumArgs(); i != e; i++) + if (const RecordType *RT = FPT->getArgType(i)->getAs<RecordType>()) + ConvertRecordDeclType(RT->getDecl()); + // Return a placeholder type. ResultType = llvm::StructType::get(getLLVMContext()); - + SkippedLayout = true; break; } Added: cfe/trunk/test/CodeGen/incomplete-function-type-2.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/incomplete-function-type-2.c?rev=168112&view=auto ============================================================================== --- cfe/trunk/test/CodeGen/incomplete-function-type-2.c (added) +++ cfe/trunk/test/CodeGen/incomplete-function-type-2.c Thu Nov 15 17:40:48 2012 @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o - %s | FileCheck %s + +// PR14355: don't crash +// Keep this test in its own file because CodeGenTypes has global state. +// CHECK: define void @test10_foo({}* %p1.coerce) nounwind { +struct test10_B; +typedef struct test10_B test10_F3(double); +void test10_foo(test10_F3 p1); +struct test10_B test10_b(double); +void test10_bar() { + test10_foo(test10_b); +} +struct test10_B {}; +void test10_foo(test10_F3 p1) +{ + p1(0.0); +} _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
