Bug 86958 - umbrello 1.3 beta c++ parser segfaults on simple class
Summary: umbrello 1.3 beta c++ parser segfaults on simple class
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-11 10:06 UTC by Sebastian Stein
Modified: 2004-09-08 20:37 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Stein 2004-08-11 10:06:31 UTC
Version:           1.3.0 (using KDE 3.2.3, compiled sources)
Compiler:          gcc version 3.3.3
OS:                Linux (i686) release 2.4.26

This class makes Umbrello crashing:

class X
{
public:
  void Y(  /**/ comment
         const int a) const; /**/ another comment

};

reported by Brett Kelford <brett@orca1.com>
Comment 1 Sebastian Stein 2004-08-11 10:09:50 UTC
This bug may also exist in KDevelop.

Program received signal SIGSEGV, Segmentation fault.
0x40eac132 in QString::deref () from /usr/lib/qt/lib/libqt-mt.so.3
(gdb) bt
#0  0x40eac132 in QString::deref () from /usr/lib/qt/lib/libqt-mt.so.3
#1  0x40eac23c in QString::operator= () from /usr/lib/qt/lib/libqt-mt.so.3
#2  0x081ce838 in Parser::parseMemberSpecification (this=0xbfffe390,
    node=@0xbfffe080) at ast.h:260
#3  0x081cc025 in Parser::parseClassSpecifier (this=0xbfffe390,
    node=@0xbfffe250) at parser.cpp:1871
#4  0x081bda75 in Parser::parseDeclaration (this=0xbfffe390, node=@0xbfffe310)
    at parser.cpp:528
#5  0x081bd4a4 in Parser::parseTranslationUnit (this=0xbfffe390,
    node=@0xbfffe430) at parser.cpp:448
#6  0x081a79f1 in Driver::parseFile (this=0x84bfa38, fileName=@0xbfffe660,
    onlyPreProcess=false, force=false) at driver.cpp:250
#7  0x08106951 in ClassImport::importCPP (this=0x84c05d0, headerFileList=
        {<QValueList<QString>> = {sh = 0x84c45b0}, <No data fields>})
    at classimport.cpp:196
#8  0x0815a266 in UMLApp::slotImportClasses (this=0x83dc4f0) at qshared.h:49
#9  0x0815b27d in UMLApp::qt_invoke (this=0x83dc4f0, _id=110, _o=0xbfffe7d0)
    at uml.moc:271
#10 0x40be3eac in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#11 0x40be3ce4 in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#12 0x4054692b in KAction::activated () from /opt/kde/lib/libkdeui.so.4
#13 0x4054630f in KAction::slotActivated () from /opt/kde/lib/libkdeui.so.4
#14 0x40546b31 in KAction::qt_invoke () from /opt/kde/lib/libkdeui.so.4
#15 0x40be3eac in QObject::activate_signal ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#16 0x40ef7c6a in QSignal::signal () from /usr/lib/qt/lib/libqt-mt.so.3
#17 0x40bfdc2d in QSignal::activate () from /usr/lib/qt/lib/libqt-mt.so.3
#18 0x40ce7315 in QPopupMenu::mouseReleaseEvent ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#19 0x40c19767 in QWidget::event () from /usr/lib/qt/lib/libqt-mt.so.3
#20 0x40b884bf in QApplication::internalNotify ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#21 0x40b87bc1 in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#22 0x4077b76d in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#23 0x40b1f681 in QETWidget::translateMouseEvent ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#24 0x40b1d73b in QApplication::x11ProcessEvent ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#25 0x40b342b1 in QEventLoop::processEvents ()
   from /usr/lib/qt/lib/libqt-mt.so.3
#26 0x40b9a678 in QEventLoop::enterLoop () from /usr/lib/qt/lib/libqt-mt.so.3
#27 0x40b9a528 in QEventLoop::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#28 0x40b88711 in QApplication::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#29 0x0813a21f in main (argc=1, argv=0xbffff514) at main.cpp:86
Comment 2 Brett Kelford 2004-08-11 20:47:14 UTC
I actually meant without the stars in the comments, like so:

class X 
{ 
public: 
  void Y(  // comment 
         const int a) const; // another comment 

};
Comment 3 Martin 2004-09-05 04:48:09 UTC
Yes, I also encountered this problem. After litle examination I solved it.
The problem is when some token with semicolon is after closing bracket of member function of class, structure or union.
Another example is 
class A {
public:
    void member() { a=1;}; //comment
};

this patch will do it:

--- parser.cpp  2004-08-10 23:02:56.000000000 +0000
+++ parser-new.cpp      2004-09-05 02:30:16.780647000 +0000
@@ -1866,7 +1866,7 @@
        if( lex->lookAhead(0) == '}' )
            break;

-       DeclarationAST::Node memSpec;
+       DeclarationAST::Node memSpec = CreateNode<DeclarationAST>() ;
        int startDecl = lex->index();
        if( !parseMemberSpecification(memSpec) ){
            if( startDecl == lex->index() )

enjoy!!!

martin
Comment 4 Jonathan Riddell 2004-09-08 20:37:37 UTC
Committed, many thanks.

Maybe this should be picked up by KDevelop as well?