CMake support memory errors

Hamish Rodda rodda at kde.org
Wed Dec 17 15:03:29 UTC 2008


On Tuesday 16 December 2008 00:55:39 Hamish Rodda wrote:
> On Monday 15 December 2008 14:58:48 David Nolden wrote:
> > Am Montag, 15. Dezember 2008 03:06:59 schrieb Hamish Rodda:
> > > Hi,
> > >
> > > Anyone know why this is happening? (opening kdevelop with both
> > > kdevplatform and kdevelop projects open)
> >
> > This is only warnings, no crashes, right? Actually I have forked
> > KDevVarLengthArray because of a crash that happened exactly in that
> > place, although I never really understood it. Now it seems like valgrind
> > still doesn't like that code too much, but still better than a crash. :)
>
> They are only warnings, but they represent incorrect memory access which
> certainly one day will cause a crash, and most days just lead to
> unpredictable behaviour, so it needs to be fixed.

I found another one, this appears to affect c++ support:

==300== Thread 9:                                                                                                                                               
==300== Invalid read of size 4                                                                                                                                  
==300==    at 0xAB3E061: KDevVarLengthArray<KDevelop::LocalIndexedDeclaration, 
10>::realloc(int, int) (kdevvarlengtharray.h:270)                                
==300==    by 0xAB3E46E: KDevVarLengthArray<KDevelop::LocalIndexedDeclaration, 
10>::append(KDevelop::LocalIndexedDeclaration const&) 
(kdevvarlengtharray.h:126) 
==300==    by 0xAB35311: 
KDevelop::DUContextDynamicData::addDeclaration(KDevelop::Declaration*) 
(ducontext.cpp:370)                                             
==300==    by 0xAB5ECC6: 
KDevelop::Declaration::setContext(KDevelop::DUContext*, bool) 
(declaration.cpp:390)                                                    
==300==    by 0x23C7AA44: 
Cpp::ClassDeclaration::ClassDeclaration(KDevelop::SimpleRange const&, 
KDevelop::DUContext*) (classdeclaration.cpp:37)                 
==300==    by 0x23C202C7: Cpp::ClassDeclaration* 
DeclarationBuilder::openDeclarationReal<Cpp::ClassDeclaration>(NameAST*, AST*, 
KDevelop::Identifier const&, bool, bool) (declarationbuilder.cpp:506)                                                                                                                           
==300==    by 0x23C20960: Cpp::ClassDeclaration* 
DeclarationBuilder::openDeclaration<Cpp::ClassDeclaration>(NameAST*, AST*, 
KDevelop::Identifier const&, bool, bool) (declarationbuilder.cpp:369)                                                                                                                               
==300==    by 0x23BFD0A2: DeclarationBuilder::openClassDefinition(NameAST*, 
AST*, bool, Cpp::ClassDeclarationData::ClassType) (declarationbuilder.cpp:565)      
==300==    by 0x23BFD265: 
DeclarationBuilder::visitClassSpecifier(ClassSpecifierAST*) 
(declarationbuilder.cpp:767)                                              
==300==    by 0x240F9F08: Visitor::visit(AST*) (visitor.cpp:113)                                                                                                
==300==    by 0x240F7D5A: DefaultVisitor::visitTypedef(TypedefAST*) 
(default_visitor.cpp:431)                                                                   
==300==    by 0x23BE7A88: ContextBuilder::visitTypedef(TypedefAST*) 
(contextbuilder.cpp:542)                                                                    
==300==  Address 0x2ccdec98 is 0 bytes after a block of size 400 alloc'd                                                                                        
==300==    at 0x4C2694E: malloc (vg_replace_malloc.c:207)                                                                                                       
==300==    by 0x892FB06: qMalloc(unsigned long) (qmalloc.cpp:51)                                                                                                
==300==    by 0xAB3DFDD: KDevVarLengthArray<KDevelop::LocalIndexedDeclaration, 
10>::realloc(int, int) (kdevvarlengtharray.h:262)                                
==300==    by 0xAB3E1A9: KDevVarLengthArray<KDevelop::LocalIndexedDeclaration, 
10>::resize(int) (kdevvarlengtharray.h:223)                                      
==300==    by 0xAB3E87D: void 
KDevelop::insertToArray<KDevVarLengthArray<KDevelop::LocalIndexedDeclaration, 
10>, 
KDevelop::Declaration*>(KDevVarLengthArray<KDevelop::LocalIndexedDeclaration, 
10>&, KDevelop::Declaration* const&, int) (arrayhelpers.h:59)                                                                    
==300==    by 0xAB3524E: 
KDevelop::DUContextDynamicData::addDeclaration(KDevelop::Declaration*) 
(ducontext.cpp:361)                                             
==300==    by 0xAB5ECC6: 
KDevelop::Declaration::setContext(KDevelop::DUContext*, bool) 
(declaration.cpp:390)                                                    
==300==    by 0xAB8149F: 
KDevelop::FunctionDeclaration::FunctionDeclaration(KDevelop::SimpleRange 
const&, KDevelop::DUContext*) (functiondeclaration.cpp:48)    
==300==    by 0x23C166F9: KDevelop::FunctionDeclaration* 
DeclarationBuilder::openDeclarationReal<KDevelop::FunctionDeclaration>(NameAST*, 
AST*, KDevelop::Identifier const&, bool, bool) (declarationbuilder.cpp:506)                                                                                                           
==300==    by 0x23C16D6E: KDevelop::FunctionDeclaration* 
DeclarationBuilder::openDeclaration<KDevelop::FunctionDeclaration>(NameAST*, 
AST*, KDevelop::Identifier const&, bool, bool) (declarationbuilder.cpp:369)                                                                                                               
==300==    by 0x23BFC9FF: 
DeclarationBuilder::openFunctionDeclaration(NameAST*, AST*) 
(declarationbuilder.cpp:644)                                              
==300==    by 0x23BFE031: DeclarationBuilder::visitDeclarator(DeclaratorAST*) 
(declarationbuilder.cpp:241)

Cheers,
Hamish.




More information about the KDevelop-devel mailing list