Bug 351188 - crash in KDevelop::DUContext::findLocalDeclarations
Summary: crash in KDevelop::DUContext::findLocalDeclarations
Status: RESOLVED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: language (show other bugs)
Version: 1.7.1
Platform: Kubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-11 13:23 UTC by ZhangHuiJie
Modified: 2015-08-18 00:08 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ZhangHuiJie 2015-08-11 13:23:08 UTC
I got this problem when try to open a c++ source file of a big project(OpenFOAM).
There was nothing wrong in the big project. With many crashes when I try to open it ,
I am sure that it's a bug. 
The debug info of gdb are:
#0  0x00007ffff1839dd2 in KDevelop::emptyConstantQualifiedIdentifierPrivateIndex () at /build/buildd/kdevplatform-1.7.1/language/duchain/identifier.cpp:339
#1  0x00007ffff1839ef9 in KDevelop::QualifiedIdentifier::QualifiedIdentifier (this=0x7fff194c60a0) at /build/buildd/kdevplatform-1.7.1/language/duchain/identifier.cpp:709
#2  0x00007ffff17f7811 in KDevelop::DUContext::scopeIdentifier (this=this@entry=0x7fff02c2dbc0, includeClasses=includeClasses@entry=true)
    at /build/buildd/kdevplatform-1.7.1/language/duchain/ducontext.cpp:1095
#3  0x00007ffff17ff968 in KDevelop::DUContext::findLocalDeclarationsInternal (this=0x7fff02c2dbc0, identifier=..., position=..., dataType=..., ret=..., flags=...)
    at /build/buildd/kdevplatform-1.7.1/language/duchain/ducontext.cpp:669

an the definition of KDevelop::emptyConstantQualifiedIdentifierPrivateIndex() is:
static uint emptyConstantQualifiedIdentifierPrivateIndex()
{
  static const uint index = qualifiedidentifierRepository()->index(DynamicQualifiedIdentifierPrivate());
  return index;
}

I don't know why this function crash for my lack of concept of  ducontext.
Thanks for any help.

Reproducible: Always

Steps to Reproduce:
I can reproduce this problem with the OpenFOAM and I am sure this problem can be to reproduced it with some other big projects.
Comment 1 Kevin Funk 2015-08-12 14:29:58 UTC
Could you add the code snippet which caused this crash? For reference?
Comment 2 Milian Wolff 2015-08-13 15:13:22 UTC
Git commit ddf0237dd589faf59478654245de88c23e01c407 by Milian Wolff, on behalf of Zhang HuiJie.
Committed on 13/08/2015 at 15:13.
Pushed by mwolff into branch '4.7'.

Set maximum number of recursive calls for getMemberFunctions to 50.

In some special cases of the curiously recurring template pattern [1],
in my code (OpenFOAM-2.3.x), the C++ plugin will get into an endless
loop and break down finally. This patch prevents it by adding a max
recursion depth of 50 to getMemberFunctions.

[1]: https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern,

REVIEW: 124712

M  +4    -3    languages/cpp/cppduchain/typeutils.cpp
M  +1    -1    languages/cpp/cppduchain/typeutils.h

http://commits.kde.org/kdevelop/ddf0237dd589faf59478654245de88c23e01c407