Bug 285004 - Crash in expression parser when parsing boost::mpl::assert
Summary: Crash in expression parser when parsing boost::mpl::assert
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: git master
Platform: Ubuntu Linux
: VHI crash
Target Milestone: 4.2.3
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-26 13:09 UTC by janitor048
Modified: 2013-03-31 00:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
CLI debug output (282.96 KB, text/plain)
2011-10-26 13:09 UTC, janitor048
Details
This header causes the parser to crash (from Boost 1.47) (12.02 KB, text/x-c++hdr)
2011-10-26 13:10 UTC, janitor048
Details

Note You need to log in before you can comment on or make changes to this bug.
Description janitor048 2011-10-26 13:09:25 UTC
Created attachment 64885 [details]
CLI debug output 

Version:           git master (using KDE 4.5.5) 
OS:                Linux

When trying to parse the file boost/mpl/assert.hpp (from Boost 1.47, haven't tried older versions yet) the expression parser crashes. Here is what print m_session->dumpNode(node) in Cpp::ExpressionVisitor::visit gives

 SimpleTypeSpecifier [ 166 , 167 ] "assert_ " 
   Name [ 166 , 167 ] "assert_ " 
     UnqualifiedName [ 166 , 167 ] "assert_ " 
     UnqualifiedName 
   Name 
 SimpleTypeSpecifier 

and here's the backtrace

#0  0x00007ffff2652ba5 in raise (sig=<value optimised out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff26566b0 in abort () at abort.c:92
#2  0x00007ffff430d864 in qt_message_output(QtMsgType, char const*) () from /usr/lib/libQtCore.so.4
#3  0x00007ffff430da42 in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007ffff430dbf5 in qFatal(char const*, ...) () from /usr/lib/libQtCore.so.4
#5  0x00007fffc6e4ecfe in TypeASTVisitor::visitSimpleTypeSpecifier (this=0x7fffc62f6200, node=0x7fffd8df63e8)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/type_visitor.cpp:158
#6  0x00007fffc6e4f2a1 in TypeASTVisitor::run (this=0x7fffc62f6200, node=0x7fffd8df63e8) at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/type_visitor.cpp:107
#7  0x00007fffc6e37b9c in Cpp::ExpressionVisitor::visitSimpleTypeSpecifier (this=0x7fffc62f7110, node=<value optimised out>)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:1152
#8  0x00007fffc6e33606 in Cpp::ExpressionVisitor::visit (this=0x7fffc62f7110, node=0x7fffd8df63e8)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:2395
#9  0x00007fffc6b1519e in DefaultVisitor::visitParameterDeclaration (this=0x28d2, node=0x7fffd8df6510)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/parser/default_visitor.cpp:310
#10 0x00007fffc6e33606 in Cpp::ExpressionVisitor::visit (this=0x7fffc62f7110, node=0x7fffd8df6510)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:2395
#11 0x00007fffc6b162cd in visitNodes<ParameterDeclarationAST*> (v=0x7fffc62f7110, nodes=<value optimised out>)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/parser/visitor.h:138
#12 0x00007fffc6e33606 in Cpp::ExpressionVisitor::visit (this=0x7fffc62f7110, node=0x7fffd8df6358)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:2395
#13 0x00007fffc6e379b3 in Cpp::ExpressionVisitor::visitDeclarator (this=0x7fffc62f7110, node=0x7fffd8df6228)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:1264
#14 0x00007fffc6e33606 in Cpp::ExpressionVisitor::visit (this=0x7fffc62f7110, node=0x7fffd8df6228)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:2395
#15 0x00007fffc6b14f5e in DefaultVisitor::visitInitDeclarator (this=0x28d2, node=0x7fffd8df6758)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/parser/default_visitor.cpp:205
#16 0x00007fffc6e3c25b in Cpp::ExpressionVisitor::visitInitDeclarator (this=0x7fffc62f7110, node=0x7fffd8df6758)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:1204
#17 0x00007fffc6e33606 in Cpp::ExpressionVisitor::visit (this=0x7fffc62f7110, node=0x7fffd8df6758)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:2395
#18 0x00007fffc6e33721 in Cpp::ExpressionVisitor::visitSimpleDeclaration (this=0x7fffc62f7110, node=<value optimised out>)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:2323
#19 0x00007fffc6e33606 in Cpp::ExpressionVisitor::visit (this=0x7fffc62f7110, node=0x7fffd8df6798)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:2395
#20 0x00007fffc6e339b1 in Cpp::ExpressionVisitor::parse (this=0x7fffc62f7110, ast=0x7fffd8df6798)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/expressionvisitor.cpp:245
#21 0x00007fffc6dfef12 in UseBuilder::visitSimpleDeclaration (this=0x7fffc62f7e70, node=0x7fffd8df6798)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/usebuilder.cpp:241
#22 0x00007fffc6b15d2d in visitNodes<DeclarationAST*> (v=0x7fffc62f7ed0, nodes=<value optimised out>)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/parser/visitor.h:138
#23 0x00007fffc6dc3063 in ContextBuilder::visitNamespace (this=0x7fffc62f7e70, node=0x7fffd8df0d48)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/contextbuilder.cpp:472
#24 0x00007fffc6b15d2d in visitNodes<DeclarationAST*> (v=0x7fffc62f7ed0, nodes=<value optimised out>)
    at /home/fochler/software/KDevelop/kdevelop/languages/cpp/parser/visitor.h:138
#25 0x00007fffc6dc6608 in KDevelop::AbstractContextBuilder<AST, NameAST>::supportBuild (this=0x7fffc62f7e70, node=0x7fffd8df0d00, context=0x7fffd8d2d530)
    at /home/fochler/usr/kdev4dbg/include/kdevplatform/language/duchain/builders/abstractcontextbuilder.h:133
#26 0x00007fffc6e01551 in KDevelop::AbstractUseBuilder<AST, NameAST, ContextBuilder>::buildUses(AST*) () from /home/fochler/usr/kdev4dbg/lib/libkdev4cppduchain.so
#27 0x00007fffc6dff1ef in UseBuilder::buildUses (this=0x7fffc62f7e70, node=0x7fffd8df0d00) at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppduchain/usebuilder.cpp:56
#28 0x00007fffc72f9c24 in CPPInternalParseJob::run (this=0x3b1ee50) at /home/fochler/software/KDevelop/kdevelop/languages/cpp/cppparsejob.cpp:713
#29 0x00007ffff63f6981 in ?? () from /usr/lib/libthreadweaver.so.4
#30 0x00007ffff63f6c7e in ThreadWeaver::Job::execute(ThreadWeaver::Thread*) () from /usr/lib/libthreadweaver.so.4
#31 0x00007ffff63f8083 in ?? () from /usr/lib/libthreadweaver.so.4
#32 0x00007ffff63f5c6f in ?? () from /usr/lib/libthreadweaver.so.4
#33 0x00007ffff63f61f8 in ThreadWeaver::Thread::run() () from /usr/lib/libthreadweaver.so.4
#34 0x00007ffff431627e in ?? () from /usr/lib/libQtCore.so.4
#35 0x00007ffff408b971 in start_thread (arg=<value optimised out>) at pthread_create.c:304
#36 0x00007ffff270592d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#37 0x0000000000000000 in ?? ()

I'll also attach the CLI output and the offending header file. kdevduchain and configuration in .kde had been cleared previously.

Reproducible: Always

Steps to Reproduce:
Open boost/mpl/assert.hpp (from boost 1.47) in kdevelop

Actual Results:  
Crash

Expected Results:  
No crash
Comment 1 janitor048 2011-10-26 13:10:57 UTC
Created attachment 64886 [details]
This header causes the parser to crash (from Boost 1.47)
Comment 2 Milian Wolff 2011-10-26 14:49:53 UTC
sigh I wonder how I could have missed that yesterday. confirmed and also hit it all the time with bigger projects due to e.g. /usr/include/c++/4.5/type_traits
Comment 3 Milian Wolff 2011-10-26 16:23:26 UTC
Git commit 260208d7cd8121c283cfbf4fc13f25b51e1d5887 by Milian Wolff.
Committed on 26/10/2011 at 18:20.
Pushed by mwolff into branch 'master'.

fix loss of top context due to recursive expressionvisitor::parse calls

wow, this took me long to figure out: the name+type visitors can
trigger a recursive call to ExpressionVisitor::parse and hence
could overwrite m_topContext = 0 on exit...

BUG: 285004

M  +3    -2    languages/cpp/cppduchain/expressionvisitor.cpp
M  +1    -0    languages/cpp/cppduchain/tests/test_duchain.h
M  +19   -1    languages/cpp/cppduchain/tests/test_duchain_cpp2011.cpp

http://commits.kde.org/kdevelop/260208d7cd8121c283cfbf4fc13f25b51e1d5887
Comment 4 Aleix Pol 2013-03-31 00:54:58 UTC
Moving all the bugs from the CPP Parser. It was not well defined the difference between it and C++ Language Support and people kept reporting in both places indistinctively