Summary: | KDevelop crashes during parsing a project when it is compiled with GCC 6.0 (due to "remove null pointer checks for 'this' optimization") [KDevelop::AbstractType::indexed] | ||
---|---|---|---|
Product: | [Applications] kdevelop | Reporter: | Jan Grulich <jgrulich> |
Component: | general | Assignee: | kdevelop-bugs-null |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | aschmidt, bruno, dontarius, independent.scientist, jgrulich, robert.berec, robert.styles.forsyth, simonandric5, skific, slawek, sylko.olzscher, zilla |
Priority: | HI | Keywords: | junior-jobs, release_blocker |
Version: | 4.90.91 | ||
Target Milestone: | 5.0.0 | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 4.7.4 | |
Attachments: |
backtrace
KDevelop build log KDevelop 5 crash backtrace KDevelop 5 crash backtrace (#2) New crash information added by DrKonqi |
Description
Jan Grulich
2016-03-18 15:28:12 UTC
Where are the problems? Do you get compile errors with GCC6 without additional compiler flags? If yes, please post them. Created attachment 97959 [details]
backtrace
I didn't see any compilation error, it compiles just fine, it crashes later once I try to open any project.
Attaching backtrace of the crash with KDevelop 4.7.3.
Created attachment 97960 [details]
KDevelop build log
Also attaching build log in hope that may help.
Git commit 513519edb3fa25d39370cee71b4813741994dd20 by Kevin Funk. Committed on 18/03/2016 at 16:41. Pushed by kfunk into branch '1.7'. Fix -fdelete-null-pointer-checks issues Prepare for upcoming GCC6, which sets this by default M +2 -3 language/duchain/topducontext.cpp http://commits.kde.org/kdevplatform/513519edb3fa25d39370cee71b4813741994dd20 Sorry, I don't have GCC6 around + I am reluctant to install it (breaks my Clang setup here, don't ask). Please check if this solves the crash for you. I'm not sure the compiler warnings in KTextEditor (-Waddress) are problematic. Didn't check. Created attachment 98003 [details]
KDevelop 5 crash backtrace
The fix above helped to KDevelop 4.7 (at least I managed to open a project successfully) , but KDevelop 5.0 still crashes. See the attached backtrace.
Git commit 935756dbab00479954d905d8ea4b29e3bd2e5647 by Kevin Funk. Committed on 21/03/2016 at 10:36. Pushed by kfunk into branch '1.7'. Fix -fdelete-null-pointer-checks issues Backtrace (reduced): 10 0x00007fc2221b9e9c in KDevelop::AbstractType::indexed() const (this=0x0) at /home/jgrulich/development/projects/kdevplatform/language/duchain/types/abstracttype.cpp:99 11 0x00007fc22212f4a6 in KDevelop::Declaration::setAbstractType(KDevelop::TypePtr<KDevelop::AbstractType>) (this=0x7fc1b40a42a0, type=...) at /home/jgrulich/development/projects/kdevplatform/language/duchain/declaration.cpp:269 12 0x00007fc1f1eb988e in (anonymous namespace)::Visitor::setDeclType<(CXCursorKind)10>(KDevelop::Declaration*, KDevelop::AbstractType*) (decl=<optimized out>, type=<optimized out>, this=<optimized out>) at /home/jgrulich/development/projects/kdevelop/languages/clang/duchain/builder.cpp:786 M +1 -1 language/duchain/declaration.cpp http://commits.kde.org/kdevplatform/935756dbab00479954d905d8ea4b29e3bd2e5647 Created attachment 98004 [details]
KDevelop 5 crash backtrace (#2)
Now I can open a project, but once I move the mouse cursor to some text to visualize the help, it crashes again. Backtrace attached.
Alright. I need to test this properly. Uses of AbstractType::indexed seem like a can of worms, most of the callers don't check AbstractType*. Thanks for testing Jan, so far, unfortunately the true fix might need to wait until I have GCC6 infrastructure ready. You don't need GCC 6, you should be able to find the null dereferences using ubsan in GCC 5, and maybe 4.9 too. But building GCC 6 isn't a big deal. https://gcc.gnu.org/wiki/InstallingGCC (In reply to Kevin Funk from comment #9) > Alright. I need to test this properly. Uses of AbstractType::indexed seem > like a can of worms, most of the callers don't check AbstractType*. Could it be solved with the NullObject pattern? i.e. make abstractType() always return a valid non-null pointer, returning a pointer to some global, empty/default/dumb object instead of null. That would mean that m_baseType->abstractType()->indexed() never dereferences null, and you don't need to fix every caller. Git commit 5ea89d672f288fc1233af86548f11388e6076e3d by Kevin Funk. Committed on 21/03/2016 at 23:37. Pushed by kfunk into branch '1.7'. Fix places with undefined behavior New API: IndexedType::IndexedType(const AbstractType::Ptr& type) Places where we may call AbstractPtr::indexed with this being a nullptr. M +1 -1 language/duchain/instantiationinformation.cpp M +1 -1 language/duchain/repositories/typerepository.cpp M +1 -1 language/duchain/repositories/typerepository.h M +1 -1 language/duchain/types/abstracttype.cpp M +2 -2 language/duchain/types/arraytype.cpp M +2 -2 language/duchain/types/containertypes.cpp M +2 -2 language/duchain/types/containertypes.h M +5 -5 language/duchain/types/functiontype.cpp M +7 -0 language/duchain/types/indexedtype.cpp M +1 -3 language/duchain/types/indexedtype.h M +2 -2 language/duchain/types/pointertype.cpp M +2 -2 language/duchain/types/referencetype.cpp M +2 -2 language/duchain/types/typealiastype.cpp http://commits.kde.org/kdevplatform/5ea89d672f288fc1233af86548f11388e6076e3d Git commit ca8d751a20b5d1e7b028af39e78547fc0e9d696b by Kevin Funk. Committed on 21/03/2016 at 23:39. Pushed by kfunk into branch '4.7'. Fix places with undefined behavior New API: IndexedType::IndexedType(const AbstractType::Ptr& type) Places where we may call AbstractPtr::indexed with this being a nullptr. Similar patches probably need to be applied to other language plugins CCMAIL: kdevelop-devel@kde.org M +3 -1 languages/cpp/cppduchain/cppducontext.h M +3 -3 languages/cpp/cppduchain/declarationbuilder.cpp M +1 -1 languages/cpp/cppduchain/expressionparser.cpp M +2 -2 languages/cpp/cppduchain/name_visitor.cpp M +2 -2 languages/cpp/cppduchain/templatedeclaration.cpp M +3 -3 languages/cpp/cppduchain/typeconversion.cpp M +2 -2 languages/cpp/cppduchain/typeutils.cpp http://commits.kde.org/kdevelop/ca8d751a20b5d1e7b028af39e78547fc0e9d696b Git commit 0101b7da8d88e01692ca2615d4b1704edac656a1 by Kevin Funk. Committed on 22/03/2016 at 12:06. Pushed by kfunk into branch '1.7'. Fix null-pointer dereference M +2 -2 language/codecompletion/codecompletionitem.cpp http://commits.kde.org/kdevplatform/0101b7da8d88e01692ca2615d4b1704edac656a1 Git commit 315957c92f52c3bf89c85b9aa4fc13fec7a67e03 by Kevin Funk. Committed on 22/03/2016 at 13:54. Pushed by kfunk into branch '5.0'. QmlJS: Protect against null-pointer derefs M +1 -1 languages/qmljs/duchain/declarationbuilder.cpp http://commits.kde.org/kdevelop/315957c92f52c3bf89c85b9aa4fc13fec7a67e03 Git commit 4510bbd27031498be2bd4bf8450af1be735e34dd by Kevin Funk. Committed on 22/03/2016 at 13:54. Pushed by kfunk into branch '5.0'. Clang: Protect against null-pointer derefs M +1 -1 languages/clang/codegen/adaptsignatureassistant.cpp M +2 -2 languages/clang/codegen/codegenhelper.cpp M +1 -1 languages/clang/codegen/sourcemanipulation.cpp http://commits.kde.org/kdevelop/4510bbd27031498be2bd4bf8450af1be735e34dd All issues in kdevplatform/kdevelop resolved. *** Bug 364028 has been marked as a duplicate of this bug. *** Please, Where on earth can one install/download version 4.7.4? Don't see it on http://download.kde.org/stable/kdevelop/, nor it is in opensuse's tumbleweed repo... Nowhere, because it isn't released (yet?). *** Bug 364750 has been marked as a duplicate of this bug. *** Created attachment 99737 [details]
New crash information added by DrKonqi
kdevelop (4.7.3) on KDE Platform 4.14.21 using Qt 4.8.7
KDevelop crashes every time I open it.
-- Backtrace (Reduced):
#6 0x00007fae0bd5246c in KDevelop::AbstractType::indexed() const () at /usr/lib64/libkdevplatformlanguage.so.8
#7 0x00007fad52ff0dec in Cpp::ExpressionParser::evaluateType(AST*, ParseSession*, KDevelop::TopDUContext const*) () at /usr/lib64/libkdev4cppduchain.so
#8 0x00007fad52fb4531 in TypeBuilder::visitSimpleTypeSpecifier(SimpleTypeSpecifierAST*) () at /usr/lib64/libkdev4cppduchain.so
#9 0x00007fad52cbf236 in DefaultVisitor::visitTypedef(TypedefAST*) () at /usr/lib64/libkdev4cppparser.so
#10 0x00007fad52f80c42 in ContextBuilder::visitTypedef(TypedefAST*) () at /usr/lib64/libkdev4cppduchain.so
*** Bug 366433 has been marked as a duplicate of this bug. *** @Jan: Can you confirm all issues have been resolved? Does KDevelop work for you? Did you also try kdev-php & kdev-python? *** Bug 364672 has been marked as a duplicate of this bug. *** *** Bug 364697 has been marked as a duplicate of this bug. *** *** Bug 364819 has been marked as a duplicate of this bug. *** *** Bug 365752 has been marked as a duplicate of this bug. *** |