SemaCXX/SemaObjCXX test failures...

I've been seeing the errors below for a couple days now.

Are other folks seeing these? (I did a clean build of both llvm and clang to make sure I had "fresh" binaries...).

snaroff

******************** TEST '/Volumes/Data/llvm/tools/clang/test/SemaObjCXX//cocoa.mm' FAILED! ********************
Command:
  clang /Volumes/Data/llvm/tools/clang/test/SemaObjCXX//cocoa.mm -print-stats
Incorrect Output:
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file /Volumes/Data/llvm/include/llvm/Support/Casting.h, line 199.
0 clang 0x00339997 _ZN4llvm3sys7Program17FindProgramByNameERKSs + 611
1 clang 0x00339c61 _ZN4llvm3sys28PrintStackTraceOnErrorSignalEv + 593
2 libSystem.B.dylib 0x94a8409b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 libSystem.B.dylib 0x94afcec2 raise + 26
5 libSystem.B.dylib 0x94b0c47f abort + 73
6 libSystem.B.dylib 0x94afe063 __assert_rtn + 101
7 clang 0x001511af _ZN4llvm4castIN5clang8TypeDeclEPNS1_4DeclEEENS_10cast_rettyIT_T0_E8ret_typeERKS7_ + 91
8 clang 0x0014f847 _ZN5clang4Sema24ActOnCXXMemberDeclaratorEPNS_5ScopeENS_15AccessSpecifierERNS_10DeclaratorEPvS6_S6_ + 355
9 clang 0x001f67bf _ZN5clang6Parser30ParseCXXClassMemberDeclarationENS_15AccessSpecifierE + 1139
10 clang 0x001f6d76 _ZN5clang6Parser27ParseCXXMemberSpecificationENS_14SourceLocationEjPv + 478
11 clang 0x001f72eb _ZN5clang6Parser19ParseClassSpecifierERNS_8DeclSpecE + 947
12 clang 0x001f2b3b _ZN5clang6Parser26ParseDeclarationSpecifiersERNS_8DeclSpecE + 2655
13 clang 0x001f3a29 _ZN5clang6Parser22ParseSimpleDeclarationEj + 39
14 clang 0x001f3b1f _ZN5clang6Parser16ParseDeclarationEj + 43
15 clang 0x0020b8e2 _ZN5clang6Parser24ParseExternalDeclarationEv + 562
16 clang 0x0020b947 _ZN5clang6Parser17ParseTopLevelDeclERPv + 85
17 clang 0x00132ba6 _ZN5clang8ParseASTERNS_12PreprocessorEPNS_11ASTConsumerEb + 404
18 clang 0x000338da _Z22InitializeIncludePathsPKcRN5clang12HeaderSearchERNS1_11FileManagerERKNS1_11LangOptionsE + 3442
19 clang 0x00034b21 main + 1643
20 clang 0x000022a2 start + 54
21 ??? 0x00000003 0x0 + 3
Output//Volumes/Data/llvm/tools/clang/test/SemaObjCXX//cocoa.mm.out.script: line 1: 70585 Abort trap clang /Volumes/Data/llvm/tools/clang/test/SemaObjCXX//cocoa.mm -print-stats

******************** TEST '/Volumes/Data/llvm/tools/clang/test/SemaCXX//carbon.cpp' FAILED! ********************
Command:
  clang /Volumes/Data/llvm/tools/clang/test/SemaCXX//carbon.cpp -fsyntax-only -print-stats
Incorrect Output:
Assertion failed: (SC == VarDecl::Static && "Invalid storage class for member!"), function ActOnDeclarator, file SemaDecl.cpp, line 754.
0 clang 0x00339997 _ZN4llvm3sys7Program17FindProgramByNameERKSs + 611
1 clang 0x00339c61 _ZN4llvm3sys28PrintStackTraceOnErrorSignalEv + 593
2 libSystem.B.dylib 0x94a8409b _sigtramp + 43
3 ??? 0xffffffff 0x0 + 4294967295
4 libSystem.B.dylib 0x94afcec2 raise + 26
5 libSystem.B.dylib 0x94b0c47f abort + 73
6 libSystem.B.dylib 0x94afe063 __assert_rtn + 101
7 clang 0x00142977 _ZN5clang4Sema15ActOnDeclaratorEPNS_5ScopeERNS_10DeclaratorEPv + 2951
8 clang 0x0014f923 _ZN5clang4Sema24ActOnCXXMemberDeclaratorEPNS_5ScopeENS_15AccessSpecifierERNS_10DeclaratorEPvS6_S6_ + 575
9 clang 0x001f67bf _ZN5clang6Parser30ParseCXXClassMemberDeclarationENS_15AccessSpecifierE + 1139
10 clang 0x001f6d76 _ZN5clang6Parser27ParseCXXMemberSpecificationENS_14SourceLocationEjPv + 478
11 clang 0x001f72eb _ZN5clang6Parser19ParseClassSpecifierERNS_8DeclSpecE + 947
12 clang 0x001f2b3b _ZN5clang6Parser26ParseDeclarationSpecifiersERNS_8DeclSpecE + 2655
13 clang 0x001f3a29 _ZN5clang6Parser22ParseSimpleDeclarationEj + 39
14 clang 0x001f3b1f _ZN5clang6Parser16ParseDeclarationEj + 43
15 clang 0x0020b8e2 _ZN5clang6Parser24ParseExternalDeclarationEv + 562
16 clang 0x0020b947 _ZN5clang6Parser17ParseTopLevelDeclERPv + 85
17 clang 0x00132ba6 _ZN5clang8ParseASTERNS_12PreprocessorEPNS_11ASTConsumerEb + 404
18 clang 0x000338da _Z22InitializeIncludePathsPKcRN5clang12HeaderSearchERNS1_11FileManagerERKNS1_11LangOptionsE + 3442
19 clang 0x00034b21 main + 1643
20 clang 0x000022a2 start + 54
Output//Volumes/Data/llvm/tools/clang/test/SemaCXX//carbon.cpp.out.script: line 1: 69379 Abort trap clang /Volumes/Data/llvm/tools/clang/test/SemaCXX//carbon.cpp -fsyntax-only -print-stats
******************** TEST '/Volumes/Data/llvm/tools/clang/test/SemaCXX//carbon.cpp' FAILED! ********************

This is in our C++ support. Not certain if these are high priority issues right now or not. I've been seeing these failures too.

Hi Steve,

Could you please post preprocessed files of cocoa.mm and carbon.cpp ?

-Argiris

steve naroff wrote:

If the tests are known to fail, plz mark them xfail

-Chris

Is it o.k. if I just send you a copy? (they are fairly large).

snaroff

Yes, certainly.

steve naroff wrote:

I fixed the asserts here: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20081013/008199.html

BTW, I'm seeing these errors on both of the files that you gave me:

carbon-i.cpp:1194:33: error: redefinition of 'size_t'
typedef __typeof__(sizeof(int)) size_t;
                                ^
carbon-i.cpp:169:25: error: previous definition is here
typedef __darwin_size_t size_t;
                        ^
carbon-i.cpp:1195:26: error: redefinition of 'va_list'
typedef __darwin_va_list va_list;
                         ^
carbon-i.cpp:197:27: error: previous definition is here
typedef __builtin_va_list va_list;
                          ^

Is this a problem of clang ?

-Argiris

steve naroff wrote:

I fixed the asserts here: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20081013/008199.html

Thanks for working on this! (It’s nice when all the tests succeed:-)

BTW, I’m seeing these errors on both of the files that you gave me:

carbon-i.cpp:1194:33: error: redefinition of ‘size_t’
typedef typeof(sizeof(int)) size_t;
^
carbon-i.cpp:169:25: error: previous definition is here
typedef __darwin_size_t size_t;
^
carbon-i.cpp:1195:26: error: redefinition of ‘va_list’
typedef __darwin_va_list va_list;
^
carbon-i.cpp:197:27: error: previous definition is here
typedef __builtin_va_list va_list;
^

Is this a problem of clang ?

This “problem” only shows up when clang parses the preprocessed file. It works fine when parsing the original source.

Here is a comment I added to Sema::MergeTypeDefDecl awhile ago:

// Redeclaration of a type is a constraint violation (6.7.2.3p1).
// Apparently GCC, Intel, and Sun all silently ignore the redeclaration if
// either declaration is in a system header. The code below implements
// this adhoc compatibility rule. FIXME: The following code will not
// work properly when compiling “.i” files (containing preprocessed output).

Regards,

snaroff

Technically speaking, this is a preprocessor/sourcelocation bug, something that's been on my todo list for a long time. The issue is that we don't track the system header bit specified by #line directives.

-Chris

This "problem" only shows up when clang parses the preprocessed file.

Just in case someone wants to fix this, gcc solves this problem by adding numbers to the ends of # lines to keep track of which files are system-headers or not. These conspire together to make the .i files work in this case.

Yes, we produce these numbers, we just ignore them when parsing the #line directive back in.

-Chris