clang barfs on var arg test case

Here's a sample case:

http://pastebin.com/P09ejk6w

built with:

clang -ccc-host-triple x86_64-pc-win32 -O0 -c -integrated-as -o test.o test.c

And here's the barf-age:

0 clang 0x0000000101308b02 PrintStackTrace(void*) + 34
1 clang 0x00000001013097a3 SignalHandler(int) + 707
2 libSystem.B.dylib 0x00007fff8056935a _sigtramp + 26
3 clang 0x000000010073df6a clang::Parser::ParseTypeName(clang::SourceRange*) + 1498
4 clang 0x0000000100390213 clang::Sema::ActOnVAArg(clang::SourceLocation, clang::ASTOwningPtr<&(clang::ActionBase::DeleteExpr(void*))>, void*, clang::SourceLocation) + 67
5 clang 0x000000010074ec2c clang::Parser::ParseBuiltinPrimaryExpression() + 2124
6 clang 0x000000010074b667 clang::Parser::ParseCastExpression(bool, bool, bool&, void*) + 3303
7 clang 0x000000010074cdc6 clang::Parser::ParseAssignmentExpression() + 54
8 clang 0x000000010074d0d8 clang::Parser::ParseExpressionList(llvm::SmallVector<void*, 12u>&, llvm::SmallVector<clang::SourceLocation, 12u>&, void (clang::Action::*)(clang::Scope*, void*, void**, unsigned int), void*) + 376
9 clang 0x000000010074d7a0 clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, void*, void*&, clang::SourceLocation&) + 688
10 clang 0x000000010074b64b clang::Parser::ParseCastExpression(bool, bool, bool&, void*) + 3275
11 clang 0x000000010074da23 clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, void*, void*&, clang::SourceLocation&) + 1331
12 clang 0x000000010074b64b clang::Parser::ParseCastExpression(bool, bool, bool&, void*) + 3275
13 clang 0x000000010074cdc6 clang::Parser::ParseAssignmentExpression() + 54
14 clang 0x000000010074c1e5 clang::Parser::ParseRHSOfBinaryExpression(clang::ASTOwningResult<&(clang::ActionBase::DeleteExpr(void*))>, clang::prec::Level) + 1461
15 clang 0x000000010074cee0 clang::Parser::ParseAssignmentExpression() + 336
16 clang 0x000000010074db27 clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool, void*, void*&, clang::SourceLocation&) + 1591
17 clang 0x000000010074b64b clang::Parser::ParseCastExpression(bool, bool, bool&, void*) + 3275
18 clang 0x000000010074bdb8 clang::Parser::ParseRHSOfBinaryExpression(clang::ASTOwningResult<&(clang::ActionBase::DeleteExpr(void*))>, clang::prec::Level) + 392
19 clang 0x000000010074cee0 clang::Parser::ParseAssignmentExpression() + 336
20 clang 0x000000010074d4b1 clang::Parser::ParseExpression() + 17
21 clang 0x000000010076a1e5 clang::Parser::ParseStatementOrDeclaration(bool) + 2405
22 clang 0x000000010076a533 clang::Parser::ParseCompoundStatementBody(bool) + 403
23 clang 0x000000010076a9bd clang::Parser::ParseFunctionStatementBody(clang::OpaquePtr<0>) + 141
24 clang 0x000000010077c7dc clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&, clang::Parser::ParsedTemplateInfo const&) + 316
25 clang 0x0000000100736f12 clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int, bool, clang::SourceLocation*) + 1794
26 clang 0x0000000100779281 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&, clang::AttributeList*, clang::AccessSpecifier) + 225
27 clang 0x00000001007796c7 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::AttributeList*, clang::AccessSpecifier) + 359
28 clang 0x000000010077ab55 clang::Parser::ParseExternalDeclaration(clang::CXX0XAttributeList) + 101
29 clang 0x000000010077b628 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<1>&) + 104
30 clang 0x00000001002a820b clang::ParseAST(clang::Preprocessor&, clang::ASTConsumer*, clang::ASTContext&, bool, bool, clang::CodeCompleteConsumer*) + 235
31 clang 0x00000001002649fc clang::CodeGenAction::ExecuteAction() + 60
32 clang 0x000000010004ec09 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 393
33 clang 0x000000010001f6f5 cc1_main(char const**, char const**, char const*, void*) + 2949
34 clang 0x0000000100026444 main + 4740
35 clang 0x000000010001d848 start + 52
Stack dump:
0. Program arguments: bin/clang -cc1 -triple x86_64-pc-win32 -emit-obj -mrelax-all -disable-free -main-file-name test.c -mrelocation-model static -mdisable-fp-elim -mconstructor-aliases -munwind-tables -target-cpu x86-64 -resource-dir lib/clang/2.8 -O0 -ferror-limit 19 -fmessage-length 126 -fms-extensions -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o test.o -x c test.c
1. test.c:24:10 <Spelling=test.c:13:54>: current parser token ')'
2. test.c:21:1: parsing function body 'Test'
3. test.c:21:1: in compound statement ('{}')
clang: error: clang frontend command failed due to signal 11 (use -v to see invocation)

Latest clang/llvm...

Cameron Esfahani
dirty@apple.com

"The cake is a lie."

Common wisdom

Looks like a bug! Please file a bugzilla, thanks!

-Chris