[cfe-dev] [Bug] Segmentation fault while getting SourceLocation of a Decl
Hugues de Lassus
hugues.de-lassus at imag.fr
Fri Mar 14 08:10:48 PDT 2014
Hi,
I am iterating on an std::map whose keys are FunctionDecl's pointers.
Many times I encounter no problems, but sometimes I get segfaults for
specific C files and I do not manage to find out why nor where parsed C
code might produces such a bug.
Every time it happens when calling clang::FunctionDecl::getNameInfo()
and then clang::Decl::getLocation()
I am wondering whether the getNameInfo/getLocation functions are always
safe or not ? Do you think it has to come from my tool ? Thanks for the
help !
Here is an example backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000544bb6 in clang::Decl::getLocation (this=0x21) at
/import/linux/x86_64/soft/llvm/3.4/include/clang/AST/DeclBase.h:373
373 SourceLocation getLocation() const { return Loc; }
(gdb) bt
#0 0x0000000000544bb6 in clang::Decl::getLocation (this=0x21) at
/import/linux/x86_64/soft/llvm/3.4/include/clang/AST/DeclBase.h:373
#1 0x0000000000544c14 in clang::FunctionDecl::getNameInfo (this=0x21)
at /import/linux/x86_64/soft/llvm/3.4/include/clang/AST/Decl.h:1605
#2 0x000000000054454f in DotGraph::printDotGraph (this=0x7fffffffe260,
IOInfo=0x14eb110) at DotGraph.cpp:32
#3 0x000000000058e27d in main (argc=4, argv=0x7fffffffe658) at main.cpp:73
--
Hugues de Lassus Saint-Geniès
More information about the cfe-dev
mailing list