[LLVMbugs] [Bug 2637] New: -serialze tries to serialize invalid ASTs

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Tue Aug 5 09:18:16 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2637

           Summary: -serialze tries to serialize invalid ASTs
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: AST
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu


If clang gets passes the -serialize switch, serialization is even attempted if
the input file is invalid. This makes e.g. producing minimized testcases for
-serialize with delta harder, because if I use

  clang -serialize bla.c | grep "Assertion failed: (isa<Fun"

then delta most of the time produces invalid C as minimized testcase.

Here's an example of the problem:

$ cat version_delta.c
        NULL,
    };
    sponsor = (int)time(NULL);
$ clang version_delta.c  -serialize
version_delta.c:2:5: error: expected identifier or '('    };
    ^
version_delta.c:1:2: error: declarator requires an identifier
        NULL,
        ^
version_delta.c:2:5: error: parse error
    };
    ^
version_delta.c:2:5: error: expected identifier or '('
version_delta.c:3:20: error: initializer element is not constant
    sponsor = (int)time(NULL);
                   ^~~~~~~~~~
Assertion failed: (isa<FunctionDecl>(d) && "DeclRefExpr can only own
FunctionDecls for implicitly def. funcs."), function EmitImpl, file
StmtSerialization.cpp, line 498.
0   clang                               0x002f182b
_ZN4llvm3sys7Program17FindProgramByNameERKSs + 611
1   clang                               0x002f1af5
_ZN4llvm3sys28PrintStackTraceOnErrorSignalEv + 593
2   libSystem.B.dylib                   0x966ed09b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libSystem.B.dylib                   0x96765ec2 raise + 26
5   libSystem.B.dylib                   0x9677547f abort + 73
6   libSystem.B.dylib                   0x96767063 __assert_rtn + 101
7   clang                               0x00198a65
_ZNK5clang11DeclRefExpr8EmitImplERN4llvm10SerializerE + 183
8   clang                               0x00196ca9
_ZNK5clang4Stmt4EmitERN4llvm10SerializerE + 77
9   clang                               0x001a9c6c
_ZN4llvm14SerializeTraitIN5clang4StmtEE4EmitERNS_10SerializerERKS2_ + 24
10  clang                               0x0019bd1a
_ZN4llvm10Serializer18BatchEmitOwnedPtrsIN5clang4StmtEEEvjPKPT_ + 104
11  clang                               0x0019816f
_ZNK5clang8CallExpr8EmitImplERN4llvm10SerializerE + 121
12  clang                               0x00196ca9
_ZNK5clang4Stmt4EmitERN4llvm10SerializerE + 77
13  clang                               0x001a9c6c
_ZN4llvm14SerializeTraitIN5clang4StmtEE4EmitERNS_10SerializerERKS2_ + 24
14  clang                               0x001a9c9e
_ZN4llvm10Serializer12EmitOwnedPtrIN5clang4StmtEEEvPT_ + 48
15  clang                               0x001980a0
_ZNK5clang8CastExpr8EmitImplERN4llvm10SerializerE + 80
16  clang                               0x00196ca9
_ZNK5clang4Stmt4EmitERN4llvm10SerializerE + 77
17  clang                               0x0019bb7a
_ZN4llvm14SerializeTraitIKN5clang4ExprEE4EmitERNS_10SerializerERS3_ + 24
18  clang                               0x00177e10
_ZN4llvm10Serializer18BatchEmitOwnedPtrsIKN5clang4ExprEKNS2_10ScopedDeclEEEvPT_PT0_
+ 66
19  clang                               0x001761b6
_ZNK5clang7VarDecl10EmitOutRecERN4llvm10SerializerE + 50
20  clang                               0x0017730c
_ZNK5clang7VarDecl8EmitImplERN4llvm10SerializerE + 42
21  clang                               0x00176156
_ZNK5clang4Decl4EmitERN4llvm10SerializerE + 66
22  clang                               0x001a10b0
_ZN4llvm14SerializeTraitIN5clang4DeclEE4EmitERNS_10SerializerERKS2_ + 24
23  clang                               0x001a10e2
_ZN4llvm10Serializer12EmitOwnedPtrIN5clang4DeclEEEvPT_ + 48
24  clang                               0x0019f940
_ZNK5clang15TranslationUnit4EmitERN4llvm10SerializerE + 126
25  clang                               0x001a06d8
_ZN5clang20EmitASTBitcodeBufferERKNS_15TranslationUnitERSt6vectorIhSaIhEE + 232
26  clang                               0x001a075d
_ZN5clang18EmitASTBitcodeFileERKNS_15TranslationUnitERKN4llvm3sys4PathE + 91
27  clang                               0x001a0808
_ZN5clang18EmitASTBitcodeFileEPKNS_15TranslationUnitERKN4llvm3sys4PathE + 30
28  clang                               0x0000416d
_ZN45_GLOBAL__N_ASTConsumers.cpp_00000000_12721AD620SingleFileSerializerD0Ev +
53
29  clang                               0x00108fb2
_ZN5clang8ParseASTERNS_12PreprocessorEPNS_11ASTConsumerEb + 630
30  clang                               0x0002a6ce
_Z16InitializeGCModeRN5clang11LangOptionsE + 5850
31  clang                               0x0002de02 main + 1596
32  clang                               0x000019c2 start + 54
Abort trap


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list