[cfe-dev] libclang crashed on nullptr
Nikola Smiljanic
popizdeh at gmail.com
Sun Aug 3 22:22:02 PDT 2014
Adding back cfe-dev
This seems to be a crash on invalid code (and as such it might take a while
to fix). I've opened a bug report with reduced test case
http://llvm.org/bugs/show_bug.cgi?id=20525
Now I suggest you do some debugging and figure out
why QtPrivate::FunctionPointer isn't defined. It might be a bug in Qt or in
the way your project is set up. It's defined in qobjectdefs_impl.h if
google is to be trusted :)
Nikola
On Fri, Aug 1, 2014 at 7:45 PM, Xavier Wang <weasley.wx at gmail.com> wrote:
> I have upload crash sample and script generated by clang to Google
> Drive: https://docs.google.com/file/d/0B7OjXWezj0rQSGVwM1FDVWpWRDA/edit
>
> this is the clang output:
>
> ------------------------------
> fatal error: too many errors emitted, stopping now [-ferror-limit=]
> Stack dump:
> 0. Program arguments: D:\MinGW\bin\clang.exe -cc1 -triple
> i686-pc-windows-g
> nu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
> -main-file-name al
> lqt_pp.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno
> -masm-verbos
> e -mconstructor-aliases -target-cpu pentium4 -coverage-file
> D:\Work\Sources\luac
> lang-parser\examples\allqt_pp.o -resource-dir
> D:\MinGW\bin\..\lib\clang\3.5.0 -f
> deprecated-macro -fdebug-compilation-dir
> D:\Work\Sources\luaclang-parser\example
> s -ferror-limit 19 -fmessage-length 80 -mstackrealign -fno-use-cxa-atexit
> -fobjc
> -runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
> -fcolor-dia
> gnostics -o allqt_pp.o -x c++ allqt_pp.cpp
> 1. D:/Qt/include\QtCore/qobject.h:247:13: current parser token
> 'connect'
> 2. D:/Qt/include\QtCore/qobject.h:114:1: parsing struct/union/class
> body 'Q
> Object'
> 0x011F877F (0x00000000 0x00000000 0x04BA5D00 0x0254CEB0)
> 0x0120AC0F (0x04BA5D00 0x0254D780 0x00000000 0x005BB868)
> 0x0115A3DE (0x00000000 0x00000000 0x0254D780 0x0254D7B8)
> 0x01135E4A (0x00000006 0x0254D780 0x0254D7B8 0x0254D998)
> 0x01136788 (0x00000006 0x0254D998 0x00000000 0x00000000)
> 0x011355AF (0x00000006 0x0254D998 0x00000000 0x00000000)
> 0x011598F9 (0x00000000 0x00000000 0x0254E10C 0x00000000)
> 0x0115AF1C (0x00135656 0x00135677 0x0254E174 0x00000012)
> 0x0115C132 (0x0000007C 0x00135656 0x0254E7D8 0x0254E790)
> 0x0113B336 (0x0254E7D8 0x0254E790 0x00000003 0x00000005)
> 0x0112DD41 (0x0254EA80 0x0254EA5C 0x0254E7D8 0x00000003)
> 0x0112DF81 (0x0254EA80 0x0254EA5C 0x00000000 0x00000003)
> 0x0112E59B (0x0254EA80 0x0254EA5C 0x00000000 0x005BB868)
> 0x0112F56E (0x0254EABC 0x005667F8 0x00561858 0x00561858)
> 0x0112BFFF (0x005A5058 0x00000000 0x00000000 0x005667F8)
> 0x00E51CDD (0x00000000 0x00000001 0x00561858 0x005667F8)
> 0x00E51C0B (0x00561858 0x005667F8 0x00000018 0x00000001)
> 0x00E40B8E (0x005667F8 0x005645D3 0x00561858 0x00561858)
> 0x00E78D6A (0x00561858 0x00000000 0x00000001 0x005645B8)
> 0x00812CA8 (0x0254F7E4 0x0254F880 0x005645B8 0x0081060E)
> 0x00811B1F (0x00000029 0x00562420 0x00555B38 0x1A8866F5)
> 0x01510242 (0x7F557000 0x0254FDC0 0x77DF98EE 0x7F557000)
> 0x77A6495D (0x7F557000 0x6CD3717D 0x00000000 0x00000000),
> BaseThreadInitThunk()
> + 0xE bytes(s)
> 0x77DF98EE (0xFFFFFFFF 0x77DEE0BF 0x00000000 0x00000000),
> RtlInitializeException
> Chain() + 0x84 bytes(s)
> 0x77DF98C4 (0x015102BF 0x7F557000 0x00000000 0x00000000),
> RtlInitializeException
> Chain() + 0x5A bytes(s)
> clang.exe: error: clang frontend command failed due to signal (use -v to
> see inv
> ocation)
> clang version 3.5.0 (212439)
> Target: i686-pc-windows-gnu
> Thread model: posix
> clang.exe: note: diagnostic msg: PLEASE submit a bug report to
> http://llvm.org/b
> ugs/ and include the crash backtrace, preprocessed source, and associated
> run sc
> ript.
> clang.exe: note: diagnostic msg:
> ********************
>
> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
> Preprocessed source(s) and associated run script(s) are located at:
> clang.exe: note: diagnostic msg:
> C:\Users\sw\AppData\Local\Temp\allqt_pp-2018c0.
> cpp
> clang.exe: note: diagnostic msg:
> C:\Users\sw\AppData\Local\Temp\allqt_pp-2018c0.
> sh
> clang.exe: note: diagnostic msg:
>
> ********************
> -------------------------
>
> 2014-08-01 13:01 GMT+08:00 Nikola Smiljanic <popizdeh at gmail.com>:
> > Can you try and reduce the preprocessed file?
> >
> >
> > On Fri, Aug 1, 2014 at 1:48 PM, Xavier Wang <weasley.wx at gmail.com>
> wrote:
> >>
> >> Hi,
> >>
> >> I have found a crash on nullptr when parse Qt header files.
> >>
> >> it caused by a dyn_cast on nullptr, at here (Line 9240 in SemaDecl.cpp):
> >>
> >> -------------------------
> >> /// FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to
> >> perform
> >> /// any semantic actions necessary after any initializer has been
> >> attached.
> >> void
> >> Sema::FinalizeDeclaration(Decl *ThisDecl) {
> >> // Note that we are no longer parsing the initializer for this
> >> declaration.
> >> ParsingInitForAutoVars.erase(ThisDecl);
> >>
> >> VarDecl *VD = dyn_cast_or_null<VarDecl>(ThisDecl);
> >> if (!VD)
> >> return;
> >>
> >> checkAttributesAfterMerging(*this, *VD);
> >>
> >> // Static locals inherit dll attributes from their function.
> >> if (VD->isStaticLocal()) {
> >> if (FunctionDecl *FD =
> >> dyn_cast<FunctionDecl>(VD->getParentFunctionOrMethod())) {
> >> // !!!here!!!
> >> ------------------------
> >>
> >> maybe dyn_cast_or_null is needed? or is there something wrong with it?
> >>
> >> the source code is the preprocessed header file for Qt 5.2, it's
> >> 5.74MB+, So I can not upload it.
> >>
> >> the stack dump is:
> >>
> >> > libclang.dll!llvm::isa_impl_cl<clang::FunctionDecl,clang::DeclContext
> >> > const *>::doit(const clang::DeclContext * Val) Line 94 C++
> >>
> libclang.dll!llvm::isa_impl_wrap<clang::FunctionDecl,clang::DeclContext
> >> const *,clang::DeclContext const *>::doit(const clang::DeclContext *
> >> const & Val) Line 122 C++
> >>
> libclang.dll!llvm::isa_impl_wrap<clang::FunctionDecl,clang::DeclContext
> >> * const,clang::DeclContext const *>::doit(clang::DeclContext * const &
> >> Val) Line 114 C++
> >> libclang.dll!llvm::isa<clang::FunctionDecl,clang::DeclContext
> >> *>(clang::DeclContext * const & Val) Line 134 C++
> >>
> >>
> libclang.dll!llvm::dyn_cast<clang::FunctionDecl,clang::DeclContext>(clang::DeclContext
> >> * Val) Line 278 C++
> >> libclang.dll!clang::Sema::FinalizeDeclaration(clang::Decl *
> >> ThisDecl) Line 9241 C++
> >>
> >>
> libclang.dll!clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier
> >> AS, clang::AttributeList * AccessAttrs, const
> >> clang::Parser::ParsedTemplateInfo & TemplateInfo,
> >> clang::ParsingDeclRAIIObject * TemplateDiags) Line 2380 C++
> >>
> libclang.dll!clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned
> >> int Context, const clang::Parser::ParsedTemplateInfo & TemplateInfo,
> >> clang::ParsingDeclRAIIObject & DiagsFromTParams, clang::SourceLocation
> >> & DeclEnd, clang::AccessSpecifier AS, clang::AttributeList *
> >> AccessAttrs) Line 173 C++
> >>
> >>
> libclang.dll!clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned
> >> int Context, clang::SourceLocation & DeclEnd, clang::AccessSpecifier
> >> AS, clang::AttributeList * AccessAttrs) Line 145 C++
> >>
> >>
> libclang.dll!clang::Parser::ParseDeclarationStartingWithTemplate(unsigned
> >> int Context, clang::SourceLocation & DeclEnd, clang::AccessSpecifier
> >> AS, clang::AttributeList * AccessAttrs) Line 39 C++
> >>
> >>
> libclang.dll!clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier
> >> AS, clang::AttributeList * AccessAttrs, const
> >> clang::Parser::ParsedTemplateInfo & TemplateInfo,
> >> clang::ParsingDeclRAIIObject * TemplateDiags) Line 2083 C++
> >>
> >>
> libclang.dll!clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation
> >> RecordLoc, clang::SourceLocation AttrFixitLoc,
> >> clang::Parser::ParsedAttributesWithRange & Attrs, unsigned int
> >> TagType, clang::Decl * TagDecl) Line 2709 C++
> >> libclang.dll!clang::Parser::ParseClassSpecifier(clang::tok::TokenKind
> >> TagTokKind, clang::SourceLocation StartLoc, clang::DeclSpec & DS,
> >> const clang::Parser::ParsedTemplateInfo & TemplateInfo,
> >> clang::AccessSpecifier AS, bool EnteringContext,
> >> clang::Parser::DeclSpecContext DSC,
> >> clang::Parser::ParsedAttributesWithRange & Attributes) Line 1639 C++
> >> libclang.dll!clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec
> >> & DS, const clang::Parser::ParsedTemplateInfo & TemplateInfo,
> >> clang::AccessSpecifier AS, clang::Parser::DeclSpecContext DSContext,
> >> clang::Parser::LateParsedAttrList * LateAttrs) Line 3111 C++
> >>
> >>
> libclang.dll!clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange
> >> & attrs, clang::ParsingDeclSpec & DS, clang::AccessSpecifier AS) Line
> >> 836 C++
> >>
> >>
> libclang.dll!clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange
> >> & attrs, clang::ParsingDeclSpec * DS, clang::AccessSpecifier AS) Line
> >> 904 C++
> >>
> >>
> libclang.dll!clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange
> >> & attrs, clang::ParsingDeclSpec * DS) Line 762 C++
> >>
> >>
> libclang.dll!clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>
> >> & Result) Line 559 C++
> >> libclang.dll!clang::ParseAST(clang::Sema & S, bool PrintStats, bool
> >> SkipFunctionBodies) Line 145 C++
> >> libclang.dll!clang::ASTFrontendAction::ExecuteAction() Line 514 C++
> >> libclang.dll!clang::FrontendAction::Execute() Line 415 C++
> >> libclang.dll!clang::ASTUnit::Parse(llvm::MemoryBuffer *
> >> OverrideMainBuffer) Line 1152 C++
> >> libclang.dll!clang::ASTUnit::LoadFromCompilerInvocation(bool
> >> PrecompilePreamble) Line 1915 C++
> >> libclang.dll!clang::ASTUnit::LoadFromCommandLine(const char * *
> >> ArgBegin, const char * * ArgEnd,
> >> llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> Diags,
> >> llvm::StringRef ResourceFilesPath, bool OnlyLocalDecls, bool
> >> CaptureDiagnostics,
> >>
> >>
> llvm::ArrayRef<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>
> >> >,llvm::MemoryBuffer *> > RemappedFiles, bool
> >> RemappedFilesKeepOriginalName, bool PrecompilePreamble,
> >> clang::TranslationUnitKind TUKind, bool CacheCodeCompletionResults,
> >> bool IncludeBriefCommentsInCodeCompletion, bool
> >> AllowPCHWithCompilerErrors, bool SkipFunctionBodies, bool
> >> UserFilesAreVolatile, bool ForSerialization,
> >> std::unique_ptr<clang::ASTUnit,std::default_delete<clang::ASTUnit> > *
> >> ErrAST) Line 2030 C++
> >> libclang.dll!clang_parseTranslationUnit_Impl(void * UserData) Line
> 2925
> >> C++
> >>
> >>
> libclang.dll!llvm::CrashRecoveryContext::RunSafelyOnThread::__l3::<lambda>()
> >> Line 96 C++
> >> libclang.dll!llvm::function_ref<void
> >> __cdecl(void)>::callback_fn<void <lambda>(void) >(int callable) Line
> >> 77 C++
> >> libclang.dll!llvm::function_ref<void __cdecl(void)>::operator()() Line
> >> 85 C++
> >> libclang.dll!llvm::function_ref<void
> >> __cdecl(void)>::callback_fn<llvm::function_ref<void __cdecl(void)>
> >> >(int callable) Line 77 C++
> >> libclang.dll!llvm::function_ref<void __cdecl(void)>::operator()() Line
> >> 85 C++
> >> libclang.dll!llvm::function_ref<void
> >> __cdecl(void)>::callback_fn<llvm::function_ref<void __cdecl(void)>
> >> >(int callable) Line 77 C++
> >> libclang.dll!llvm::function_ref<void __cdecl(void)>::operator()() Line
> >> 85 C++
> >>
> >>
> libclang.dll!llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void
> >> __cdecl(void)> Fn) Line 319 C++
> >> libclang.dll!RunSafelyOnThread_Dispatch(void * UserData) Line 366 C++
> >> libclang.dll!ThreadCallback(void * param) Line 81 C++
> >> [外部代码]
> >> [下面的框架可能不正确和/或缺失,没有为 kernel32.dll 加载符号]
> >>
> >>
> >> Anyone can help me?
> >>
> >> --
> >> regards,
> >> Xavier Wang.
> >>
> >> _______________________________________________
> >> cfe-dev mailing list
> >> cfe-dev at cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> >
> >
>
>
>
> --
> regards,
> Xavier Wang.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140804/8f0fc7ee/attachment.html>
More information about the cfe-dev
mailing list