[LLVMbugs] [Bug 11236] New: module import of STL fails assert in RevertTokenIDToIdentifier

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 26 02:52:29 PDT 2011


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

           Summary: module import of STL fails assert in
                    RevertTokenIDToIdentifier
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: Axel.Naumann at cern.ch
                CC: llvmbugs at cs.uiuc.edu


$ cat stl.h
#include <string>
$ clang++ -Xclang -emit-module -c -o stl.pcm -x c++ stl.h
$ cat usestl.cxx
__import_module__ stl
std::string s="ABC";
extern "C" int printf(const char*,...);
int main(int, char*[]) {
   printf("s is \"%s\"\n", s.c_str());
   return 0;
}
$ clang++ -Xclang -fmodule-cache-path -Xclang . -Xclang -fdisable-module-hash
usestl.cxx
clang:
/build/llvm/src/tools/clang/lib/Serialization/../../include/clang/Basic/IdentifierTable.h:153:
void clang::IdentifierInfo::RevertTokenIDToIdentifier(): Assertion `TokenID !=
tok::identifier && "Already at tok::identifier"' failed.
0  clang           0x0000000002aa757e
1  clang           0x0000000002aa7a7a
2  libpthread.so.0 0x00007fb61ca8b060
3  libc.so.6       0x00007fb61bd6d3a5 gsignal + 53
4  libc.so.6       0x00007fb61bd70b0b abort + 379
5  libc.so.6       0x00007fb61bd65d4d __assert_fail + 221
6  clang           0x000000000120a28a
clang::IdentifierInfo::RevertTokenIDToIdentifier() + 74
7  clang           0x00000000011ee81c
clang::serialization::reader::ASTIdentifierLookupTrait::ReadData(std::pair<char
const*, unsigned int> const&, unsigned char const*, unsigned int) + 668
8  clang           0x000000000123cfbb
clang::OnDiskChainedHashTable<clang::serialization::reader::ASTIdentifierLookupTrait>::iterator::operator*()
const + 43
9  clang           0x00000000011f9307
10 clang           0x00000000012f5cce
clang::serialization::ModuleManager::visit(bool
(*)(clang::serialization::Module&, void*), void*) + 414
11 clang           0x00000000011f9118 clang::ASTReader::ReadAST(std::string
const&, clang::serialization::ModuleKind) + 616
12 clang           0x0000000001137ec2
clang::CompilerInstance::loadModule(clang::SourceLocation,
clang::IdentifierInfo&, clang::SourceLocation) + 2546
13 clang           0x00000000015c92a9
clang::Sema::ActOnModuleImport(clang::SourceLocation, clang::IdentifierInfo&,
clang::SourceLocation) + 89
14 clang           0x00000000014c31f4 clang::Parser::ParseModuleImport() + 292
15 clang           0x00000000014c29ab
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 3083
16 clang           0x00000000014c1d59
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 361
17 clang           0x000000000149846e clang::ParseAST(clang::Sema&, bool) + 334
18 clang           0x000000000115be18 clang::ASTFrontendAction::ExecuteAction()
+ 264
19 clang           0x00000000012fb693 clang::CodeGenAction::ExecuteAction() +
1059
20 clang           0x000000000115ba63 clang::FrontendAction::Execute() + 307
21 clang           0x00000000011372ad
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 797
22 clang           0x0000000001101081
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 961
23 clang           0x00000000010ef64e cc1_main(char const**, char const**, char
const*, void*) + 926
24 clang           0x00000000010fb05d main + 477
25 libc.so.6       0x00007fb61bd5830d __libc_start_main + 237
26 clang           0x00000000010ef1e9
Stack dump:
0.    Program arguments: /build/llvm/deb-inst/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
usestl.cxx -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.21.53.20110810 -momit-leaf-frame-pointer -resource-dir
/build/llvm/deb-inst/bin/../lib/clang/3.1 -fmodule-cache-path
/var/tmp/clang-module-cache -fdeprecated-macro -fdebug-compilation-dir
/build/root/cintcling -ferror-limit 19 -fmessage-length 157 -fgnu-runtime
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-fmodule-cache-path . -fdisable-module-hash -o /tmp/usestl-nhNAqx.o -x c++
usestl.cxx 
1.    usestl.cxx:2:1: current parser token 'std'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /tmp/usestl-vHMJJk.ii

The token causing this (identifier "__is_fundamental") sits in 
/usr/include/c++/4.6/bits/cpp_type_traits.h:334:    struct __is_fundamental

$ clang --version
clang version 3.1 (trunk 142797)
Target: x86_64-unknown-linux-gnu
Thread model: posix

Let me know if I can help with debugging (e.g. where to look...)

Cheers, Axel.

-- 
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