Skip to content

Segmentation fault when parsing JUCE #309

Closed
@mingodad

Description

@mingodad

While testing cxx with this project https://github.com/juce-framework/JUCE I'm getting a segfault with the command shown bellow:

gdb --args ../build/src/frontend/cxx JUCE/modules/juce_core/juce_core.cpp -fsyntax-only -toolchain linux -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -IJUCE/modules/juce_core/..
GNU gdb (Ubuntu 10.2-0ubuntu1~18.04~2) 10.2
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ../build/src/frontend/cxx...
(gdb) r
Starting program: cplusplus-parser-dad/build/src/frontend/cxx JUCE/modules/juce_core/juce_core.cpp -fsyntax-only -toolchain linux -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -IJUCE/modules/juce_core/..

Program received signal SIGSEGV, Segmentation fault.
std::_Rb_tree<cxx::Name const*, std::pair<cxx::Name const* const, cxx::Symbol*>, std::_Select1st<std::pair<cxx::Name const* const, cxx::Symbol*> >, std::less<cxx::Name const*>, std::allocator<std::pair<cxx::Name const* const, cxx::Symbol*> > >::_M_begin (this=0x10) at /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:745
745		  (this->_M_impl._M_header._M_parent);
(gdb) bt
#0  std::_Rb_tree<cxx::Name const*, std::pair<cxx::Name const* const, cxx::Symbol*>, std::_Select1st<std::pair<cxx::Name const* const, cxx::Symbol*> >, std::less<cxx::Name const*>, std::allocator<std::pair<cxx::Name const* const, cxx::Symbol*> > >::_M_begin (this=0x10) at /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:745
#1  0x000055555581540d in std::_Rb_tree<cxx::Name const*, std::pair<cxx::Name const* const, cxx::Symbol*>, std::_Select1st<std::pair<cxx::Name const* const, cxx::Symbol*> >, std::less<cxx::Name const*>, std::allocator<std::pair<cxx::Name const* const, cxx::Symbol*> > >::equal_range (this=0x10, __k=@0x7fffffffa950: 0x555558b8c0a0)
    at /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_tree.h:2001
#2  0x000055555581532d in std::multimap<cxx::Name const*, cxx::Symbol*, std::less<cxx::Name const*>, std::allocator<std::pair<cxx::Name const* const, cxx::Symbol*> > >::equal_range (this=0x10, __x=@0x7fffffffa950: 0x555558b8c0a0)
    at /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/stl_multimap.h:1048
#3  0x0000555555809db9 in cxx::Scope::get (this=0x0, name=0x555558b8c0a0)
    at cplusplus-parser-dad/src/parser/cxx/scope.h:52
#4  0x00005555557fe7d8 in cxx::Parser::parse_class_head (this=0x7fffffffc0b8, classHead=...)
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:9090
#5  0x00005555557fe034 in cxx::Parser::parse_class_specifier(cxx::ClassSpecifierAST*&, cxx::Parser::DeclSpecs&, std::vector<cxx::TemplateDeclarationAST*, std::allocator<cxx::TemplateDeclarationAST*> > const&)::$_0::operator()() const (
    this=0x7fffffffac78)
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:8958
#6  0x00005555557ebca6 in cxx::Parser::parse_class_specifier (this=0x7fffffffc0b8, yyast=@0x7fffffffade8: 0x0, 
    specs=..., templateDeclarations=std::vector of length 0, capacity 0)
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:8971
#7  0x00005555557f32be in cxx::Parser::parse_class_specifier (this=0x7fffffffc0b8, yyast=@0x7fffffffade8: 0x0, 
    specs=...) at cplusplus-parser-dad/src/parser/cxx/parser.cc:8931
#8  0x00005555557f1de0 in cxx::Parser::parse_defining_type_specifier (this=0x7fffffffc0b8, 
    yyast=@0x7fffffffb0b0: 0x0, specs=...)
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:5388
--Type <RET> for more, q to quit, c to continue without paging--
#9  0x00005555557f1632 in cxx::Parser::parse_decl_specifier (this=0x7fffffffc0b8, yyast=@0x7fffffffb0b0: 0x0, 
    specs=...) at cplusplus-parser-dad/src/parser/cxx/parser.cc:5159
#10 0x00005555557e59ea in cxx::Parser::parse_decl_specifier_seq (this=0x7fffffffc0b8, 
    yyast=@0x7fffffffb1d8: 0x5555577cd9f0, specs=...)
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:5183
#11 0x00005555557ede42 in cxx::Parser::parse_simple_declaration(cxx::DeclarationAST*&, std::vector<cxx::TemplateDeclarationAST*, std::allocator<cxx::TemplateDeclarationAST*> > const&, cxx::Parser::BindingContext)::$_0::operator()() const (this=0x7fffffffb1c0)
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:4673
#12 0x00005555557e73d2 in cxx::Parser::parse_simple_declaration (this=0x7fffffffc0b8, yyast=@0x5555577cd8f0: 0x0, 
    templateDeclarations=std::vector of length 1, capacity 1 = {...}, ctx=cxx::Parser::BindingContext::kTemplate)
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:4679
#13 0x00005555557e62be in cxx::Parser::parse_template_declaration_body (this=0x7fffffffc0b8, 
    yyast=@0x5555577cd8f0: 0x0, templateDeclarations=std::vector of length 1, capacity 1 = {...})
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:4269
#14 0x0000555555802615 in cxx::Parser::parse_template_declaration (this=0x7fffffffc0b8, 
    yyast=@0x7fffffffb468: 0x5555577cd8c0, templateDeclarations=std::vector of length 1, capacity 1 = {...})
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:9974
#15 0x00005555557e77d6 in cxx::Parser::parse_template_declaration (this=0x7fffffffc0b8, 
    yyast=@0x7fffffffb468: 0x5555577cd8c0)
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:9930
#16 0x00005555557fee8f in cxx::Parser::parse_member_declaration (this=0x7fffffffc0b8, yyast=@0x7fffffffb578: 0x0)
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:9183
#17 0x00005555557fe44d in cxx::Parser::parse_member_specification (this=0x7fffffffc0b8, yyast=@0x7fffffffb578: 0x0)
    at cplusplus-parser-dad/src/parser/cxx/parser.cc:9152
#18 0x00005555557fe26e in cxx::Parser::parse_class_body (this=0x7fffffffc0b8, yyast=@0x5555577cc5c0: 0x5555577cc870)

clang16 parse it fine:

clang-16-env clang++ /home/mingo/dev/c/A_programming-languages/JUCE/modules/juce_core/juce_core.cpp -fsyntax-only -DJUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1 -I/home/mingo/dev/c/A_programming-languages/JUCE/modules/juce_core/..
## no error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions