[LLVMbugs] [Bug 10511] New: libclang crash when calling clang_reparseTranslationUnit

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 27 04:31:39 PDT 2011


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

           Summary: libclang crash when calling
                    clang_reparseTranslationUnit
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: Erik.Verbruggen at Me.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


When reparsing a translation unit with the flag
CXTranslationUnit_CXXPrecompiledPreamble on (as
clang_defaultEditingTranslationUnitOptions does), then reparsing gives either:

Assertion failed: ((Offset & (1U << 31)) == 0 && "Bad offset in reading source
location"), function ReadSourceLocation, file
/data/clang-llvm/llvm/tools/clang/include/clang/Serialization/ASTReader.h, line
1456.
libclang: crash detected during reparsing
reparse failed.

or:

Assertion failed: ((LatestDecl->getLocation().isInvalid() ||
NewLatest->getLocation().isInvalid() ||
!Reader.SourceMgr.isBeforeInTranslationUnit( NewLatest->getLocation(),
LatestDecl->getLocation())) && "The new latest is supposed to come after the
previous latest"), function VisitRedeclarableTemplateDecl, file
/data/clang-llvm/llvm/tools/clang/lib/Serialization/ASTReaderDecl.cpp, line
1094.
libclang: crash detected during reparsing

Turning off CXTranslationUnit_CXXPrecompiledPreamble stops clang from crashing.

To reproduce:
- unzip the attached zip file
- download and unzip Qt 4.8
(http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.8.0-beta1.zip)
- copy qconfig.h to Qt's src/corelib/global directory
- edit gen-pch.sh for the QTDIR and the CLANGDIR
- run gen-pch.sh, that will generate the pre-compiled header from pch.h
- compile and run main.cpp which will parse crash.cpp and show the crash.

I already minimized the number of includes. Preprocessing the .cpp file and
including that will unfortunately not show the crash.

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