Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When executing "test-main" I'm getting segfault #276

Closed
mingodad opened this issue May 23, 2023 · 9 comments
Closed

When executing "test-main" I'm getting segfault #276

mingodad opened this issue May 23, 2023 · 9 comments

Comments

@mingodad
Copy link
Contributor

On Ubuntu 18.04 64 bits when running test-main I'm getting a segfault and valgrind report several problems like:

==24805== Memcheck, a memory error detector
==24805== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==24805== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==24805== Command: ./test-main
==24805== 
Running main() from cpp-peglib-last/build/_deps/googletest-src/googletest/src/gtest_main.cc
[==========] Running 169 tests from 17 test suites.
[----------] Global test environment set-up.
[----------] 64 tests from GeneralTest
[ RUN      ] GeneralTest.Simple_syntax_test_with_unicode
[       OK ] GeneralTest.Simple_syntax_test_with_unicode (1076 ms)
...
[----------] 24 tests from LeftRecursiveTest (996 ms total)

[----------] 1 test from UserRuleTest
[ RUN      ] UserRuleTest.User_defined_rule_test
==24805== Invalid read of size 1
==24805==    at 0x1660CB: peg::Holder::parse_core(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x164E73: peg::Ope::parse(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x163322: peg::Definition::parse_core(char const*, unsigned long, peg::SemanticValues&, std::any&, char const*, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x162953: peg::Definition::parse(char const*, unsigned long, std::any&, char const*, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x17DFEE: peg::ParserGenerator::perform_core(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool&, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x169640: peg::ParserGenerator::parse(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool&, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x18085B: peg::parser::load_grammar(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x180660: peg::parser::parser(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2201E3: peg::parser::parser(std::basic_string_view<char, std::char_traits<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x20217F: UserRuleTest_User_defined_rule_test_Test::TestBody() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2784CB: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2712CA: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==  Address 0x6767221 is 273 bytes inside a block of size 584 free'd
==24805==    at 0x4C35FD9: operator delete(void*) (vg_replace_malloc.c:1025)
==24805==    by 0x1D1759: __gnu_cxx::new_allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> >::deallocate(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>*, unsigned long) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1C047E: std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::deallocate(std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> >&, std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>*, unsigned long) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1D13E2: std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::_M_deallocate_node_ptr(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1C0161: std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1AE9EB: std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x19D261: std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::clear() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x18AEE3: std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1698CB: std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, peg::Definition, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> > >::~unordered_map() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x23EC31: LeftRecursiveTest_PEG_EndOfFile_Test::TestBody() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2784CB: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2712CA: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==  Block was alloc'd at
==24805==    at 0x4C337DB: operator new(unsigned long) (vg_replace_malloc.c:472)
==24805==    by 0x1D164C: __gnu_cxx::new_allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> >::allocate(unsigned long, void const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1C03D7: std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::allocate(std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> >&, unsigned long) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x240DD9: std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>* std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::_M_allocate_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> const&>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x240BC8: std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_Hashtable(std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&)::{lambda(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> const*)#1}::operator()(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> const*) const (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x240F9F: void std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_assign<std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_assign(std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&)::{lambda(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> const*)#1}>(std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&, std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_assign(std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&)::{lambda(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> const*)#1} const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x240CAA: std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_Hashtable(std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x240878: std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, peg::Definition, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> > >::unordered_map(std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, peg::Definition, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x23EA02: LeftRecursiveTest_PEG_EndOfFile_Test::TestBody() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2784CB: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2712CA: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x24B47B: testing::Test::Run() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805== 
==24805== Invalid read of size 8
==24805==    at 0x1661C0: peg::Holder::parse_core(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x164E73: peg::Ope::parse(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x163322: peg::Definition::parse_core(char const*, unsigned long, peg::SemanticValues&, std::any&, char const*, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x162953: peg::Definition::parse(char const*, unsigned long, std::any&, char const*, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x17DFEE: peg::ParserGenerator::perform_core(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool&, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x169640: peg::ParserGenerator::parse(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool&, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x18085B: peg::parser::load_grammar(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x180660: peg::parser::parser(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2201E3: peg::parser::parser(std::basic_string_view<char, std::char_traits<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x20217F: UserRuleTest_User_defined_rule_test_Test::TestBody() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2784CB: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2712CA: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==  Address 0x6767190 is 128 bytes inside a block of size 584 free'd
==24805==    at 0x4C35FD9: operator delete(void*) (vg_replace_malloc.c:1025)
==24805==    by 0x1D1759: __gnu_cxx::new_allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> >::deallocate(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>*, unsigned long) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1C047E: std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::deallocate(std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> >&, std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>*, unsigned long) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1D13E2: std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::_M_deallocate_node_ptr(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1C0161: std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::_M_deallocate_node(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1AE9EB: std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::_M_deallocate_nodes(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x19D261: std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::clear() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x18AEE3: std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::~_Hashtable() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1698CB: std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, peg::Definition, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> > >::~unordered_map() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x23EC31: LeftRecursiveTest_PEG_EndOfFile_Test::TestBody() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2784CB: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2712CA: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==  Block was alloc'd at
==24805==    at 0x4C337DB: operator new(unsigned long) (vg_replace_malloc.c:472)
==24805==    by 0x1D164C: __gnu_cxx::new_allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> >::allocate(unsigned long, void const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x1C03D7: std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::allocate(std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> >&, unsigned long) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x240DD9: std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true>* std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> > >::_M_allocate_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> const&>(std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x240BC8: std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_Hashtable(std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&)::{lambda(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> const*)#1}::operator()(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> const*) const (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x240F9F: void std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_assign<std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_assign(std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&)::{lambda(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> const*)#1}>(std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&, std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_assign(std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&)::{lambda(std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, true> const*)#1} const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x240CAA: std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_Hashtable(std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x240878: std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, peg::Definition, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> > >::unordered_map(std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, peg::Definition, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x23EA02: LeftRecursiveTest_PEG_EndOfFile_Test::TestBody() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2784CB: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2712CA: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x24B47B: testing::Test::Run() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805== 
...
==24805== 
==24805== Process terminating with default action of signal 11 (SIGSEGV)
==24805==  Access not within mapped region at address 0x0
==24805==    at 0x160B3C: peg::ReferenceChecker::visit(peg::Holder&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x16803B: peg::Holder::accept(peg::Ope::Visitor&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x162A71: peg::Definition::accept(peg::Ope::Visitor&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x17ECFD: peg::ParserGenerator::perform_core(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool&, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x169640: peg::ParserGenerator::parse(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool&, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x18085B: peg::parser::load_grammar(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x180660: peg::parser::parser(char const*, unsigned long, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2201E3: peg::parser::parser(std::basic_string_view<char, std::char_traits<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<peg::Ope>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<peg::Ope> > > > const&) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x20217F: UserRuleTest_User_defined_rule_test_Test::TestBody() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2784CB: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x2712CA: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==    by 0x24B47B: testing::Test::Run() (in /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/test/test-main)
==24805==  If you believe this happened as a result of a stack
==24805==  overflow in your program's main thread (unlikely but
==24805==  possible), you can try to increase the size of the
==24805==  main thread stack using the --main-stacksize= flag.
==24805==  The main thread stack size used in this run was 8388608.
==24805== 
==24805== HEAP SUMMARY:
==24805==     in use at exit: 229,249 bytes in 1,611 blocks
==24805==   total heap usage: 67,327 allocs, 65,716 frees, 5,340,655 bytes allocated
==24805== 
==24805== LEAK SUMMARY:
==24805==    definitely lost: 0 bytes in 0 blocks
==24805==    indirectly lost: 0 bytes in 0 blocks
==24805==      possibly lost: 0 bytes in 0 blocks
==24805==    still reachable: 229,249 bytes in 1,611 blocks
==24805==         suppressed: 0 bytes in 0 blocks
==24805== Rerun with --leak-check=full to see details of leaked memory
==24805== 
==24805== For lists of detected and suppressed errors, rerun with: -s
==24805== ERROR SUMMARY: 4137 errors from 25 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)

@mingodad
Copy link
Contributor Author

After replacing all auto g = by auto &g = and Grammar g = by Grammar &g = in test3.cc no more segfaults but some tests fail:

==25818== Memcheck, a memory error detector
==25818== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==25818== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==25818== Command: ./test-main
==25818== 
Running main() from /home/mingo/dev/c/A_grammars/cpp-peglib-last/build/_deps/googletest-src/googletest/src/gtest_main.cc
[==========] Running 169 tests from 17 test suites.
[----------] Global test environment set-up.
[----------] 64 tests from GeneralTest
[ RUN      ] GeneralTest.Simple_syntax_test_with_unicode
[       OK ] GeneralTest.Simple_syntax_test_with_unicode (1054 ms)
[ RUN      ] GeneralTest.Simple_syntax_test
[       OK ] GeneralTest.Simple_syntax_test (29 ms)
[ RUN      ] GeneralTest.Empty_syntax_test
[       OK ] GeneralTest.Empty_syntax_test (4 ms)
[ RUN      ] GeneralTest.Start_rule_with_ignore_operator_test
[       OK ] GeneralTest.Start_rule_with_ignore_operator_test (29 ms)
[ RUN      ] GeneralTest.Invalid_UTF8_text_test
[       OK ] GeneralTest.Invalid_UTF8_text_test (15 ms)
[ RUN      ] GeneralTest.Backslash_escape_sequence_test
[       OK ] GeneralTest.Backslash_escape_sequence_test (28 ms)
[ RUN      ] GeneralTest.Invalid_escape_sequence_test
[       OK ] GeneralTest.Invalid_escape_sequence_test (29 ms)
[ RUN      ] GeneralTest.Action_taking_non_const_Semantic_Values_parameter
[       OK ] GeneralTest.Action_taking_non_const_Semantic_Values_parameter (80 ms)
[ RUN      ] GeneralTest.String_capture_test
[       OK ] GeneralTest.String_capture_test (138 ms)
[ RUN      ] GeneralTest.String_capture_test2
[       OK ] GeneralTest.String_capture_test2 (23 ms)
[ RUN      ] GeneralTest.String_capture_test3
[       OK ] GeneralTest.String_capture_test3 (97 ms)
[ RUN      ] GeneralTest.Cyclic_grammer_test
[       OK ] GeneralTest.Cyclic_grammer_test (7 ms)
[ RUN      ] GeneralTest.Visit_test
[       OK ] GeneralTest.Visit_test (7 ms)
[ RUN      ] GeneralTest.Token_check_test
[       OK ] GeneralTest.Token_check_test (260 ms)
[ RUN      ] GeneralTest.Lambda_action_test
[       OK ] GeneralTest.Lambda_action_test (42 ms)
[ RUN      ] GeneralTest.enter_leave_handlers_test
[       OK ] GeneralTest.enter_leave_handlers_test (139 ms)
[ RUN      ] GeneralTest.WHITESPACE_test
[       OK ] GeneralTest.WHITESPACE_test (173 ms)
[ RUN      ] GeneralTest.WHITESPACE_test2
[       OK ] GeneralTest.WHITESPACE_test2 (149 ms)
[ RUN      ] GeneralTest.WHITESPACE_test3
[       OK ] GeneralTest.WHITESPACE_test3 (152 ms)
[ RUN      ] GeneralTest.WHITESPACE_test4
[       OK ] GeneralTest.WHITESPACE_test4 (144 ms)
[ RUN      ] GeneralTest.Word_expression_test
[       OK ] GeneralTest.Word_expression_test (100 ms)
[ RUN      ] GeneralTest.Word_expression_test_PrioritizedChoice
[       OK ] GeneralTest.Word_expression_test_PrioritizedChoice (102 ms)
[ RUN      ] GeneralTest.Word_expression_test_Dictionary
[       OK ] GeneralTest.Word_expression_test_Dictionary (137 ms)
[ RUN      ] GeneralTest.Skip_token_test
[       OK ] GeneralTest.Skip_token_test (82 ms)
[ RUN      ] GeneralTest.Skip_token_test2
[       OK ] GeneralTest.Skip_token_test2 (88 ms)
[ RUN      ] GeneralTest.Custom_AST_test
[       OK ] GeneralTest.Custom_AST_test (129 ms)
[ RUN      ] GeneralTest.Backtracking_test
[       OK ] GeneralTest.Backtracking_test (121 ms)
[ RUN      ] GeneralTest.Backtracking_with_AST
[       OK ] GeneralTest.Backtracking_with_AST (127 ms)
[ RUN      ] GeneralTest.Octal_Hex_Unicode_value_test
[       OK ] GeneralTest.Octal_Hex_Unicode_value_test (27 ms)
[ RUN      ] GeneralTest.Ignore_case_literal_test
[       OK ] GeneralTest.Ignore_case_literal_test (93 ms)
[ RUN      ] GeneralTest.Ignore_case_character_class_test
[       OK ] GeneralTest.Ignore_case_character_class_test (23 ms)
[ RUN      ] GeneralTest.Ignore_case_negate_character_class_test
[       OK ] GeneralTest.Ignore_case_negate_character_class_test (19 ms)
[ RUN      ] GeneralTest.mutable_lambda_test
[       OK ] GeneralTest.mutable_lambda_test (43 ms)
[ RUN      ] GeneralTest.Simple_calculator_test
[       OK ] GeneralTest.Simple_calculator_test (171 ms)
[ RUN      ] GeneralTest.Simple_calculator_with_recovery_test
[       OK ] GeneralTest.Simple_calculator_with_recovery_test (291 ms)
[ RUN      ] GeneralTest.Calculator_test
[       OK ] GeneralTest.Calculator_test (44 ms)
[ RUN      ] GeneralTest.Calculator_test2
[       OK ] GeneralTest.Calculator_test2 (238 ms)
[ RUN      ] GeneralTest.Calculator_test3
[       OK ] GeneralTest.Calculator_test3 (221 ms)
[ RUN      ] GeneralTest.Calculator_test_with_AST
[       OK ] GeneralTest.Calculator_test_with_AST (297 ms)
[ RUN      ] GeneralTest.Calculator_test_with_combinators_and_AST
[       OK ] GeneralTest.Calculator_test_with_combinators_and_AST (28 ms)
[ RUN      ] GeneralTest.Ignore_semantic_value_test
[       OK ] GeneralTest.Ignore_semantic_value_test (86 ms)
[ RUN      ] GeneralTest.Ignore_semantic_value_of_or_predicate_test
[       OK ] GeneralTest.Ignore_semantic_value_of_or_predicate_test (134 ms)
[ RUN      ] GeneralTest.Ignore_semantic_value_of_and_predicate_test
[       OK ] GeneralTest.Ignore_semantic_value_of_and_predicate_test (124 ms)
[ RUN      ] GeneralTest.Literal_token_on_AST_test1
[       OK ] GeneralTest.Literal_token_on_AST_test1 (75 ms)
[ RUN      ] GeneralTest.Literal_token_on_AST_test2
[       OK ] GeneralTest.Literal_token_on_AST_test2 (109 ms)
[ RUN      ] GeneralTest.Literal_token_on_AST_test3
[       OK ] GeneralTest.Literal_token_on_AST_test3 (111 ms)
[ RUN      ] GeneralTest.Literal_token_on_AST_test4
[       OK ] GeneralTest.Literal_token_on_AST_test4 (123 ms)
[ RUN      ] GeneralTest.Missing_missing_definitions_test
[       OK ] GeneralTest.Missing_missing_definitions_test (47 ms)
[ RUN      ] GeneralTest.Definition_duplicates_test
[       OK ] GeneralTest.Definition_duplicates_test (39 ms)
[ RUN      ] GeneralTest.Semantic_values_test
[       OK ] GeneralTest.Semantic_values_test (110 ms)
[ RUN      ] GeneralTest.Ordered_choice_count
[       OK ] GeneralTest.Ordered_choice_count (32 ms)
[ RUN      ] GeneralTest.Ordered_choice_count_2
[       OK ] GeneralTest.Ordered_choice_count_2 (35 ms)
[ RUN      ] GeneralTest.Semantic_value_tag
[       OK ] GeneralTest.Semantic_value_tag (85 ms)
[ RUN      ] GeneralTest.Negated_Class_test
[       OK ] GeneralTest.Negated_Class_test (28 ms)
[ RUN      ] GeneralTest.token_to_number_float_test
[       OK ] GeneralTest.token_to_number_float_test (40 ms)
[ RUN      ] GeneralTest.ParentReferencesShouldNotBeExpired
[       OK ] GeneralTest.ParentReferencesShouldNotBeExpired (72 ms)
[ RUN      ] GeneralTest.EndOfInputTest
[       OK ] GeneralTest.EndOfInputTest (42 ms)
[ RUN      ] GeneralTest.DefaultEndOfInputTest
[       OK ] GeneralTest.DefaultEndOfInputTest (38 ms)
[ RUN      ] GeneralTest.DisableEndOfInputCheckTest
[       OK ] GeneralTest.DisableEndOfInputCheckTest (37 ms)
[ RUN      ] GeneralTest.InvalidCutOperator
[       OK ] GeneralTest.InvalidCutOperator (37 ms)
[ RUN      ] GeneralTest.HeuristicErrorTokenTest
[       OK ] GeneralTest.HeuristicErrorTokenTest (155 ms)
[ RUN      ] GeneralTest.LiteralContentInAST
[       OK ] GeneralTest.LiteralContentInAST (1510 ms)
[ RUN      ] GeneralTest.ChoiceWithWhitespace
[       OK ] GeneralTest.ChoiceWithWhitespace (72 ms)
[ RUN      ] GeneralTest.PassingContextAndOutputParameter
[       OK ] GeneralTest.PassingContextAndOutputParameter (45 ms)
[----------] 64 tests from GeneralTest (8186 ms total)

[----------] 7 tests from TokenBoundaryTest
[ RUN      ] TokenBoundaryTest.Token_boundary_1
[       OK ] TokenBoundaryTest.Token_boundary_1 (68 ms)
[ RUN      ] TokenBoundaryTest.Token_boundary_2
[       OK ] TokenBoundaryTest.Token_boundary_2 (72 ms)
[ RUN      ] TokenBoundaryTest.Token_boundary_3
[       OK ] TokenBoundaryTest.Token_boundary_3 (85 ms)
[ RUN      ] TokenBoundaryTest.Token_boundary_4
[       OK ] TokenBoundaryTest.Token_boundary_4 (86 ms)
[ RUN      ] TokenBoundaryTest.Token_boundary_5
[       OK ] TokenBoundaryTest.Token_boundary_5 (98 ms)
[ RUN      ] TokenBoundaryTest.Token_boundary_6
[       OK ] TokenBoundaryTest.Token_boundary_6 (118 ms)
[ RUN      ] TokenBoundaryTest.Token_boundary_7
[       OK ] TokenBoundaryTest.Token_boundary_7 (129 ms)
[----------] 7 tests from TokenBoundaryTest (661 ms total)

[----------] 16 tests from InfiniteLoopTest
[ RUN      ] InfiniteLoopTest.Infinite_loop_1
[       OK ] InfiniteLoopTest.Infinite_loop_1 (59 ms)
[ RUN      ] InfiniteLoopTest.Infinite_loop_2
[       OK ] InfiniteLoopTest.Infinite_loop_2 (56 ms)
[ RUN      ] InfiniteLoopTest.Infinite_loop_3
[       OK ] InfiniteLoopTest.Infinite_loop_3 (59 ms)
[ RUN      ] InfiniteLoopTest.Infinite_loop_4
[       OK ] InfiniteLoopTest.Infinite_loop_4 (60 ms)
[ RUN      ] InfiniteLoopTest.Infinite_loop_5
[       OK ] InfiniteLoopTest.Infinite_loop_5 (94 ms)
[ RUN      ] InfiniteLoopTest.Infinite_loop_6
[       OK ] InfiniteLoopTest.Infinite_loop_6 (15 ms)
[ RUN      ] InfiniteLoopTest.Infinite_loop_7
[       OK ] InfiniteLoopTest.Infinite_loop_7 (26 ms)
[ RUN      ] InfiniteLoopTest.Infinite_loop_8
[       OK ] InfiniteLoopTest.Infinite_loop_8 (26 ms)
[ RUN      ] InfiniteLoopTest.Infinite_loop_9
[       OK ] InfiniteLoopTest.Infinite_loop_9 (33 ms)
[ RUN      ] InfiniteLoopTest.Not_infinite_1
[       OK ] InfiniteLoopTest.Not_infinite_1 (88 ms)
[ RUN      ] InfiniteLoopTest.Not_infinite_2
[       OK ] InfiniteLoopTest.Not_infinite_2 (97 ms)
[ RUN      ] InfiniteLoopTest.Not_infinite_3
[       OK ] InfiniteLoopTest.Not_infinite_3 (237 ms)
[ RUN      ] InfiniteLoopTest.whitespace
[       OK ] InfiniteLoopTest.whitespace (47 ms)
[ RUN      ] InfiniteLoopTest.word
[       OK ] InfiniteLoopTest.word (59 ms)
[ RUN      ] InfiniteLoopTest.in_sequence
[       OK ] InfiniteLoopTest.in_sequence (41 ms)
[ RUN      ] InfiniteLoopTest.in_prioritized_choice
[       OK ] InfiniteLoopTest.in_prioritized_choice (48 ms)
[----------] 16 tests from InfiniteLoopTest (1048 ms total)

[----------] 6 tests from PrecedenceTest
[ RUN      ] PrecedenceTest.Precedence_climbing
[       OK ] PrecedenceTest.Precedence_climbing (314 ms)
[ RUN      ] PrecedenceTest.Precedence_climbing_with_literal_operator
[       OK ] PrecedenceTest.Precedence_climbing_with_literal_operator (318 ms)
[ RUN      ] PrecedenceTest.Precedence_climbing_with_macro
[       OK ] PrecedenceTest.Precedence_climbing_with_macro (272 ms)
[ RUN      ] PrecedenceTest.Precedence_climbing_error1
[       OK ] PrecedenceTest.Precedence_climbing_error1 (297 ms)
[ RUN      ] PrecedenceTest.Precedence_climbing_error2
[       OK ] PrecedenceTest.Precedence_climbing_error2 (268 ms)
[ RUN      ] PrecedenceTest.Precedence_climbing_error3
[       OK ] PrecedenceTest.Precedence_climbing_error3 (248 ms)
[----------] 6 tests from PrecedenceTest (1717 ms total)

[----------] 3 tests from PackratTest
[ RUN      ] PackratTest.Packrat_parser_test_with_whitespace
[       OK ] PackratTest.Packrat_parser_test_with_whitespace (61 ms)
[ RUN      ] PackratTest.Packrat_parser_test_with_macro
[       OK ] PackratTest.Packrat_parser_test_with_macro (316 ms)
[ RUN      ] PackratTest.Packrat_parser_test_with_precedence_expression_parser
[       OK ] PackratTest.Packrat_parser_test_with_precedence_expression_parser (139 ms)
[----------] 3 tests from PackratTest (516 ms total)

[----------] 8 tests from BackreferenceTest
[ RUN      ] BackreferenceTest.Backreference_test
[       OK ] BackreferenceTest.Backreference_test (211 ms)
[ RUN      ] BackreferenceTest.Undefined_backreference_test
[       OK ] BackreferenceTest.Undefined_backreference_test (21 ms)
[ RUN      ] BackreferenceTest.Invalid_backreference_test
[       OK ] BackreferenceTest.Invalid_backreference_test (144 ms)
[ RUN      ] BackreferenceTest.Nested_capture_test
[       OK ] BackreferenceTest.Nested_capture_test (255 ms)
[ RUN      ] BackreferenceTest.Backreference_with_Prioritized_Choice_test
[       OK ] BackreferenceTest.Backreference_with_Prioritized_Choice_test (263 ms)
[ RUN      ] BackreferenceTest.Backreference_with_Zero_or_More_test
[       OK ] BackreferenceTest.Backreference_with_Zero_or_More_test (268 ms)
[ RUN      ] BackreferenceTest.Backreference_with_One_or_More_test
[       OK ] BackreferenceTest.Backreference_with_One_or_More_test (260 ms)
[ RUN      ] BackreferenceTest.Backreference_with_Option_test
[       OK ] BackreferenceTest.Backreference_with_Option_test (274 ms)
[----------] 8 tests from BackreferenceTest (1696 ms total)

[----------] 5 tests from RepetitionTest
[ RUN      ] RepetitionTest.Repetition_0
[       OK ] RepetitionTest.Repetition_0 (78 ms)
[ RUN      ] RepetitionTest.Repetition_2_4
[       OK ] RepetitionTest.Repetition_2_4 (44 ms)
[ RUN      ] RepetitionTest.Repetition_2_1
[       OK ] RepetitionTest.Repetition_2_1 (43 ms)
[ RUN      ] RepetitionTest.Repetition_2
[       OK ] RepetitionTest.Repetition_2 (46 ms)
[ RUN      ] RepetitionTest.Repetition__2
[       OK ] RepetitionTest.Repetition__2 (46 ms)
[----------] 5 tests from RepetitionTest (257 ms total)

[----------] 24 tests from LeftRecursiveTest
[ RUN      ] LeftRecursiveTest.Left_recursive_test
[       OK ] LeftRecursiveTest.Left_recursive_test (39 ms)
[ RUN      ] LeftRecursiveTest.Left_recursive_with_option_test
[       OK ] LeftRecursiveTest.Left_recursive_with_option_test (43 ms)
[ RUN      ] LeftRecursiveTest.Left_recursive_with_zom_test
[       OK ] LeftRecursiveTest.Left_recursive_with_zom_test (20 ms)
[ RUN      ] LeftRecursiveTest.Left_recursive_with_a_ZOM_content_rule
[       OK ] LeftRecursiveTest.Left_recursive_with_a_ZOM_content_rule (41 ms)
[ RUN      ] LeftRecursiveTest.Left_recursive_with_empty_string_test
[       OK ] LeftRecursiveTest.Left_recursive_with_empty_string_test (17 ms)
[ RUN      ] LeftRecursiveTest.PEG_Definition
unknown file: Failure
C++ exception with description "bad any_cast" thrown in the test body.
[  FAILED  ] LeftRecursiveTest.PEG_Definition (37 ms)
[ RUN      ] LeftRecursiveTest.PEG_Expression
unknown file: Failure
C++ exception with description "bad any_cast" thrown in the test body.
[  FAILED  ] LeftRecursiveTest.PEG_Expression (13 ms)
[ RUN      ] LeftRecursiveTest.PEG_Sequence
unknown file: Failure
C++ exception with description "bad any_cast" thrown in the test body.
[  FAILED  ] LeftRecursiveTest.PEG_Sequence (9 ms)
[ RUN      ] LeftRecursiveTest.PEG_Prefix
unknown file: Failure
C++ exception with description "bad any_cast" thrown in the test body.
[  FAILED  ] LeftRecursiveTest.PEG_Prefix (8 ms)
[ RUN      ] LeftRecursiveTest.PEG_Suffix
unknown file: Failure
C++ exception with description "bad any_cast" thrown in the test body.
[  FAILED  ] LeftRecursiveTest.PEG_Suffix (10 ms)
[ RUN      ] LeftRecursiveTest.PEG_Primary
unknown file: Failure
C++ exception with description "bad any_cast" thrown in the test body.
[  FAILED  ] LeftRecursiveTest.PEG_Primary (14 ms)
[ RUN      ] LeftRecursiveTest.PEG_Identifier
[       OK ] LeftRecursiveTest.PEG_Identifier (15 ms)
[ RUN      ] LeftRecursiveTest.PEG_IdentStart
[       OK ] LeftRecursiveTest.PEG_IdentStart (8 ms)
[ RUN      ] LeftRecursiveTest.PEG_IdentRest
[       OK ] LeftRecursiveTest.PEG_IdentRest (8 ms)
[ RUN      ] LeftRecursiveTest.PEG_Literal
[       OK ] LeftRecursiveTest.PEG_Literal (48 ms)
[ RUN      ] LeftRecursiveTest.PEG_Class
[       OK ] LeftRecursiveTest.PEG_Class (47 ms)
[ RUN      ] LeftRecursiveTest.PEG_Negated_Class
[       OK ] LeftRecursiveTest.PEG_Negated_Class (47 ms)
[ RUN      ] LeftRecursiveTest.PEG_Range
[       OK ] LeftRecursiveTest.PEG_Range (12 ms)
[ RUN      ] LeftRecursiveTest.PEG_Char
[       OK ] LeftRecursiveTest.PEG_Char (69 ms)
[ RUN      ] LeftRecursiveTest.PEG_Operators
[       OK ] LeftRecursiveTest.PEG_Operators (22 ms)
[ RUN      ] LeftRecursiveTest.PEG_Comment
[       OK ] LeftRecursiveTest.PEG_Comment (7 ms)
[ RUN      ] LeftRecursiveTest.PEG_Space
[       OK ] LeftRecursiveTest.PEG_Space (7 ms)
[ RUN      ] LeftRecursiveTest.PEG_EndOfLine
[       OK ] LeftRecursiveTest.PEG_EndOfLine (7 ms)
[ RUN      ] LeftRecursiveTest.PEG_EndOfFile
[       OK ] LeftRecursiveTest.PEG_EndOfFile (3 ms)
[----------] 24 tests from LeftRecursiveTest (557 ms total)

[----------] 1 test from UserRuleTest
[ RUN      ] UserRuleTest.User_defined_rule_test
[       OK ] UserRuleTest.User_defined_rule_test (82 ms)
[----------] 1 test from UserRuleTest (82 ms total)

[----------] 1 test from PredicateTest
[ RUN      ] PredicateTest.Semantic_predicate_test
[       OK ] PredicateTest.Semantic_predicate_test (32 ms)
[----------] 1 test from PredicateTest (32 ms total)

[----------] 4 tests from UnicodeTest
[ RUN      ] UnicodeTest.Japanese_character
[       OK ] UnicodeTest.Japanese_character (193 ms)
[ RUN      ] UnicodeTest.dot_with_a_code
[       OK ] UnicodeTest.dot_with_a_code (22 ms)
[ RUN      ] UnicodeTest.dot_with_a_char
[       OK ] UnicodeTest.dot_with_a_char (22 ms)
[ RUN      ] UnicodeTest.character_class
[       OK ] UnicodeTest.character_class (49 ms)
[----------] 4 tests from UnicodeTest (287 ms total)

[----------] 16 tests from MacroTest
[ RUN      ] MacroTest.Macro_simple_test
[       OK ] MacroTest.Macro_simple_test (91 ms)
[ RUN      ] MacroTest.Macro_two_parameters
[       OK ] MacroTest.Macro_two_parameters (99 ms)
[ RUN      ] MacroTest.Macro_syntax_error
[       OK ] MacroTest.Macro_syntax_error (30 ms)
[ RUN      ] MacroTest.Macro_missing_argument
[       OK ] MacroTest.Macro_missing_argument (61 ms)
[ RUN      ] MacroTest.Macro_reference_syntax_error
[       OK ] MacroTest.Macro_reference_syntax_error (50 ms)
[ RUN      ] MacroTest.Macro_invalid_macro_reference_error
[       OK ] MacroTest.Macro_invalid_macro_reference_error (40 ms)
[ RUN      ] MacroTest.Macro_calculator
[       OK ] MacroTest.Macro_calculator (320 ms)
[ RUN      ] MacroTest.Macro_expression_arguments
[       OK ] MacroTest.Macro_expression_arguments (99 ms)
[ RUN      ] MacroTest.Macro_recursive
[       OK ] MacroTest.Macro_recursive (77 ms)
[ RUN      ] MacroTest.Macro_recursive2
[       OK ] MacroTest.Macro_recursive2 (515 ms)
[ RUN      ] MacroTest.Macro_exclusive_modifiers
[       OK ] MacroTest.Macro_exclusive_modifiers (257 ms)
[ RUN      ] MacroTest.Macro_token_check_test
[       OK ] MacroTest.Macro_token_check_test (315 ms)
[ RUN      ] MacroTest.Macro_passes_an_arg_to_another_macro
[       OK ] MacroTest.Macro_passes_an_arg_to_another_macro (54 ms)
[ RUN      ] MacroTest.Unreferenced_rule
[       OK ] MacroTest.Unreferenced_rule (69 ms)
[ RUN      ] MacroTest.Nested_macro_call
[       OK ] MacroTest.Nested_macro_call (77 ms)
[ RUN      ] MacroTest.Nested_macro_call2
[       OK ] MacroTest.Nested_macro_call2 (123 ms)
[----------] 16 tests from MacroTest (2280 ms total)

[----------] 1 test from LineInformationTest
[ RUN      ] LineInformationTest.Line_information_test
[       OK ] LineInformationTest.Line_information_test (83 ms)
[----------] 1 test from LineInformationTest (83 ms total)

[----------] 2 tests from DicTest
[ RUN      ] DicTest.Dictionary
[       OK ] DicTest.Dictionary (71 ms)
[ RUN      ] DicTest.Dictionary_invalid
[       OK ] DicTest.Dictionary_invalid (59 ms)
[----------] 2 tests from DicTest (130 ms total)

[----------] 8 tests from ErrorTest
[ RUN      ] ErrorTest.Default_error_handling_1
[       OK ] ErrorTest.Default_error_handling_1 (105 ms)
[ RUN      ] ErrorTest.Default_error_handling_2
[       OK ] ErrorTest.Default_error_handling_2 (111 ms)
[ RUN      ] ErrorTest.Default_error_handling_fiblang
[       OK ] ErrorTest.Default_error_handling_fiblang (679 ms)
[ RUN      ] ErrorTest.Error_recovery_1
[       OK ] ErrorTest.Error_recovery_1 (680 ms)
[ RUN      ] ErrorTest.Error_recovery_2
[       OK ] ErrorTest.Error_recovery_2 (266 ms)
[ RUN      ] ErrorTest.Error_recovery_3
[       OK ] ErrorTest.Error_recovery_3 (1083 ms)
[ RUN      ] ErrorTest.Error_recovery_Java
[       OK ] ErrorTest.Error_recovery_Java (1202 ms)
[ RUN      ] ErrorTest.Error_message_with_rule_instruction
[       OK ] ErrorTest.Error_message_with_rule_instruction (197 ms)
[----------] 8 tests from ErrorTest (4323 ms total)

[----------] 2 tests from StateTest
[ RUN      ] StateTest.Indent
[       OK ] StateTest.Indent (216 ms)
[ RUN      ] StateTest.NestedBlocks
[       OK ] StateTest.NestedBlocks (306 ms)
[----------] 2 tests from StateTest (522 ms total)

[----------] 1 test from PEGTest
[ RUN      ] PEGTest.PEG_Grammar
unknown file: Failure
C++ exception with description "bad any_cast" thrown in the test body.
[  FAILED  ] PEGTest.PEG_Grammar (3 ms)
[----------] 1 test from PEGTest (3 ms total)

[----------] Global test environment tear-down
[==========] 169 tests from 17 test suites ran. (22430 ms total)
[  PASSED  ] 162 tests.
[  FAILED  ] 7 tests, listed below:
[  FAILED  ] LeftRecursiveTest.PEG_Definition
[  FAILED  ] LeftRecursiveTest.PEG_Expression
[  FAILED  ] LeftRecursiveTest.PEG_Sequence
[  FAILED  ] LeftRecursiveTest.PEG_Prefix
[  FAILED  ] LeftRecursiveTest.PEG_Suffix
[  FAILED  ] LeftRecursiveTest.PEG_Primary
[  FAILED  ] PEGTest.PEG_Grammar

 7 FAILED TESTS
==25818== 
==25818== HEAP SUMMARY:
==25818==     in use at exit: 0 bytes in 0 blocks
==25818==   total heap usage: 94,579 allocs, 94,579 frees, 6,232,518 bytes allocated
==25818== 
==25818== All heap blocks were freed -- no leaks are possible
==25818== 
==25818== For lists of detected and suppressed errors, rerun with: -s
==25818== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

@mingodad
Copy link
Contributor Author

If I only have auto g = in:

TEST(LeftRecursiveTest, PEG_Definition) {
  auto g = ParserGenerator::grammar();
  EXPECT_TRUE(exact(g, "Definition", "Definition <- a / (b c) / d "));
  EXPECT_TRUE(exact(g, "Definition", "Definition <- a / b c / d "));
  EXPECT_TRUE(exact(g, "Definition", u8"Definitiond ← a "));
  EXPECT_FALSE(exact(g, "Definition", "Definition "));
  EXPECT_FALSE(exact(g, "Definition", " "));
  EXPECT_FALSE(exact(g, "Definition", ""));
  EXPECT_FALSE(exact(g, "Definition", "Definition = a / (b c) / d "));
  EXPECT_TRUE(exact(g, "Definition", "Macro(param) <- a "));
  EXPECT_FALSE(exact(g, "Definition", "Macro (param) <- a "));
}

Then all tests pass and no segfault occur.

@mingodad
Copy link
Contributor Author

Making a cut down version and testing it I'm getting the stack trace shown bellow:

#include <peglib.h>

using namespace peg;

bool exact(Grammar &g, const char *d, const char *s) {
  auto n = strlen(s);
  auto r = g[d].parse(s, n);
  return r.ret && r.len == n;
}

int main(int argc, char** argv) {

  Grammar &g = ParserGenerator::grammar();
  exact(g, "Definition", "Definition <- a / (b c) / d ");
  return 0;
}

Stack trace:

__GI_raise (sig=6, sig@entry=6)	
__GI_abort ()	
?? ()	
?? ()	
std::terminate() ()	
__cxa_throw ()	
std::__throw_system_error(int) ()	
std::call_once<peg::Definition::initialize_definition_ids() const::{lambda()#1}>(std::once_flag&, peg::Definition::initialize_definition_ids() const::{lambda()#1}&&) (__once=@0x555555832394: {_M_once = 0}, __f=@0x7fffffffda00: {__this = 0x5555558321b8})	
peg::Definition::initialize_definition_ids (this=0x5555558321b8)	
peg::Definition::parse_core(char const*, unsigned long, peg::SemanticValues&, std::any&, char const*, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const (this=0x5555558321b8, s=0x5555555db08f \"Definition <- a / (b c) / d \", n=28, vs=@0x7fffffffdea0: {<std::vector<std::any, std::allocator<std::any> >> = std::vector of length 0, capacity 0, path = 0x0, ss = 0x0, tags = std::vector of length 0, capacity 0, tokens = std::vector of length 0, capacity 0, c_ = 0x0, sv_ = \"\", choice_count_ = 0, choice_ = 0, name_ = \"\"}, dt=std::any [no contained value], path=0x0, log={<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x555555835e00, _M_const_object = 0x555555835e00, _M_function_pointer = 0x555555835e00, _M_member_pointer = (void (std::_Undefined_class::*)(class std::_Undefined_class * const)) 0x555555835e00, this adjustment 93824995238296}, _M_pod_data = \"\\000^\\203UUU\\000\\000\\230!\\203UUU\\000\"}, _M_manager = 0x0}, _M_invoker = 0x5555555a6fae <std::__detail::_Hash_node_value_base<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >::_M_valptr()+28>})	
peg::Definition::parse(char const*, unsigned long, char const*, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const (this=0x5555558321b8, s=0x5555555db08f \"Definition <- a / (b c) / d \", n=28, path=0x0, log={<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x7fffffffdfd0, _M_const_object = 0x7fffffffdfd0, _M_function_pointer = 0x7fffffffdfd0, _M_member_pointer = (void (std::_Undefined_class::*)(class std::_Undefined_class * const)) 0x7fffffffdfd0, this adjustment 11}, _M_pod_data = \"\\320\\337\\377\\377\\377\\177\\000\\000\\v\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x636f00006e6f69})	
exact (g=std::unordered_map with 70 elements, d=0x5555555dacb1 \"Definition\", s=0x5555555db08f \"Definition <- a / (b c) / d \")	
main (argc=1, argv=0x7fffffffe198)	

@mingodad
Copy link
Contributor Author

Compiling with clang15 the minimal example shown above, I'm getting a different stack trace:

cd '/tmp/cpp-peglib/mytest-nb'
/usr/bin/make -f Makefile CONF=Debug clean
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
make[1]: Entering directory '/tmp/cpp-peglib/mytest-nb'
rm -f -r build/Debug
make[1]: Leaving directory '/tmp/cpp-peglib/mytest-nb'

CLEAN SUCCESSFUL (total time: 53ms)
cd '/tmp/cpp-peglib/mytest-nb'
/usr/bin/make -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/tmp/cpp-peglib/mytest-nb'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/mytest-nb
make[2]: Entering directory '/tmp/cpp-peglib/mytest-nb'
mkdir -p build/Debug/GNU-Linux
rm -f "build/Debug/GNU-Linux/main.o.d"
clang-15-env clang++ -std=c++17   -c -g -Wall -I.. -MMD -MP -MF "build/Debug/GNU-Linux/main.o.d" -o build/Debug/GNU-Linux/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux
clang-15-env clang++ -o dist/Debug/GNU-Linux/mytest-nb build/Debug/GNU-Linux/main.o -lpthread
make[2]: Leaving directory '/tmp/cpp-peglib/mytest-nb'
make[1]: Leaving directory '/tmp/cpp-peglib/mytest-nb'
...
__GI_raise (sig=6, sig@entry=6)	
__GI_abort ()	
?? ()	
?? ()	
std::terminate() ()	
__cxa_throw ()	
std::__throw_bad_any_cast ()	
std::any_cast<peg::ParserGenerator::Data*> (__any=std::any [no contained value])	
peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#1}::operator()(peg::Context const&, char const*, unsigned long, std::any&) const (this=0x5555558314e8, dt=std::any [no contained value])	
std::__invoke_impl<void, peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#1}&, peg::Context const&, char const*, unsigned long, std::any&>(std::__invoke_other, peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#1}&, peg::Context const&, char const*&&, unsigned long&&, std::any&) (__f=@0x5555558314e8: {<No data fields>}, __args=std::any [no contained value], __args=std::any [no contained value], __args=std::any [no contained value], __args=std::any [no contained value])	
std::__invoke_r<void, peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#1}&, peg::Context const&, char const*, unsigned long, std::any&>(peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#1}&, peg::Context const&, char const*&&, unsigned long&&, std::any&) (__fn=@0x5555558314e8: {<No data fields>}, __args=std::any [no contained value], __args=std::any [no contained value], __args=std::any [no contained value], __args=std::any [no contained value])	
std::_Function_handler<void (peg::Context const&, char const*, unsigned long, std::any&), peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#1}>::_M_invoke(std::_Any_data const&, peg::Context const&, char const*&&, unsigned long&&, std::any&) (__functor=@0x5555558314e8: {_M_unused = {_M_object = 0x55555581e310 <peg::ParserGenerator::get_instance()::instance>, _M_const_object = 0x55555581e310 <peg::ParserGenerator::get_instance()::instance>, _M_function_pointer = 0x55555581e310 <peg::ParserGenerator::get_instance()::instance>, _M_member_pointer = (void (std::_Undefined_class::*)(class std::_Undefined_class * const)) 0x55555581e310 <peg::ParserGenerator::get_instance()::instance>, this adjustment 93824995234920}, _M_pod_data = \"\\020\\343\\201UUU\\000\\000h\\024\\203UUU\\000\"}, __args=std::any [no contained value], __args=std::any [no contained value], __args=std::any [no contained value], __args=std::any [no contained value])	
std::function<void (peg::Context const&, char const*, unsigned long, std::any&)>::operator()(peg::Context const&, char const*, unsigned long, std::any&) const (this=0x5555558314e8, __args=std::any [no contained value], __args=std::any [no contained value], __args=std::any [no contained value], __args=std::any [no contained value])	
peg::Holder::parse_core(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const::{lambda(std::any&)#1}::operator()(std::any&) const (this=0x7fffffffd790, a_val=std::any [no contained value])	
peg::Context::packrat<peg::Holder::parse_core(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const::{lambda(std::any&)#1}>(char const*, unsigned long, unsigned long&, std::any&, peg::Holder::parse_core(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const::{lambda(std::any&)#1}) (this=0x7fffffffda90, a_s=0x5555555dbc92 \"Definition <- a / (b c) / d \", def_id=0, len=@0x7fffffffd848: 93824992328501, val=std::any [no contained value], fn={this = 0x5555558316a0, c = @0x7fffffffda90, s = @0x7fffffffd888, n = @0x7fffffffd880, dt = std::any [no contained value], len = @0x7fffffffd848})	
peg::Holder::parse_core (this=0x5555558316a0, s=0x5555555dbc92 \"Definition <- a / (b c) / d \", n=28, vs=@0x7fffffffde58: {<std::vector<std::any, std::allocator<std::any> >> = std::vector of length 0, capacity 0, path = 0x0, ss = 0x0, tags = std::vector of length 0, capacity 0, tokens = std::vector of length 0, capacity 0, c_ = 0x0, sv_ = \"\", choice_count_ = 0, choice_ = 0, name_ = }, c=@0x7fffffffda90: {path = 0x0, s = 0x5555555dbc92 \"Definition <- a / (b c) / d \", l = 28, error_info = {error_pos = 0x0, expected_tokens = std::vector of length 0, capacity 0, message_pos = 0x0, message = , label = , last_output_pos = 0x0, keep_previous_token = false}, recovered = false, value_stack = std::vector of length 0, capacity 0, value_stack_size = 0, rule_stack = std::vector of length 0, capacity 0, args_stack = std::vector of length 1, capacity 1 = {std::vector of length 0, capacity 0}, in_token_boundary_count = 0, whitespaceOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, in_whitespace = false, wordOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, capture_scope_stack = std::vector of length 1, capacity 1 = {std::map with 0 elements}, capture_scope_stack_size = 1, cut_stack = std::vector<bool> of length 0, capacity 0, def_count = 68, enablePackratParsing = false, cache_registered = std::vector<bool> of length 0, capacity 0, cache_success = std::vector<bool> of length 0, capacity 0, cache_values = std::map with 0 elements, tracer_enter = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x65636e6575716500, _M_const_object = 0x65636e6575716500, _M_function_pointer = 0x65636e6575716500, _M_member_pointer = (void (std::_Undefined_class::*)(class std::_Undefined_class * const)) 0x65636e6575716500, this adjustment 256}, _M_pod_data = \"\\000equence\\000\\001\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x555555568b1c <std::char_traits<char>::compare(char const*, char const*, unsigned long)+60>}, tracer_leave = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, unsigned long, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x5555555b2290 <std::_Function_handler<std::any (peg::SemanticValues&, std::any&), peg::Action::make_adaptor<peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8}>(peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8})::{lambda(auto:1&, auto:2&)#1}>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>, _M_const_object = 0x5555555b2290 <std::_Function_handler<std::any (peg::SemanticValues&, std::any&), peg::Action::make_adaptor<peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8}>(peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8})::{lambda(auto:1&, auto:2&)#1}>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>, _M_function_pointer = 0x5555555b2290 <std::_Function_handler<std::any (peg::SemanticValues&, std::any&), peg::Action::make_adaptor<peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8}>(peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8})::{lambda(auto:1&, auto:2&)#1}>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>, _M_member_pointer = (void (std::_Undefined_class::*)(class std::_Undefined_class * const)) 0x5555555b2290 <std::_Function_handler<std::any (peg::SemanticValues&, std::any&), peg::Action::make_adaptor<peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8}>(peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8})::{lambda(auto:1&, auto:2&)#1}>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>, this adjustment 93824992617024}, _M_pod_data = \"\\220\\\"[UUU\\000\\000@\\\"[UUU\\000\"}, _M_manager = 0x0}, _M_invoker = 0x555555831458}, trace_data = std::any [no contained value], verbose_trace = false, log = {<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0xb, _M_const_object = 0xb, _M_function_pointer = 0xb, _M_member_pointer = &virtual table offset 10, this adjustment 8386676065534438915}, _M_pod_data = \"\\v\\000\\000\\000\\000\\000\\000\\000\\003nstruct\"}, _M_manager = 0x0}, _M_invoker = 0x7fffffffdd40}, next_trace_id = 0, trace_ids = std::vector of length 0, capacity 0, ignore_trace_state = false, source_line_index_init_ = {_M_once = 0}, source_line_index = std::vector of length 0, capacity 0}, dt=std::any [no contained value])	
peg::Ope::parse (this=0x5555558316a0, s=0x5555555dbc92 \"Definition <- a / (b c) / d \", n=28, vs=@0x7fffffffde58: {<std::vector<std::any, std::allocator<std::any> >> = std::vector of length 0, capacity 0, path = 0x0, ss = 0x0, tags = std::vector of length 0, capacity 0, tokens = std::vector of length 0, capacity 0, c_ = 0x0, sv_ = \"\", choice_count_ = 0, choice_ = 0, name_ = }, c=@0x7fffffffda90: {path = 0x0, s = 0x5555555dbc92 \"Definition <- a / (b c) / d \", l = 28, error_info = {error_pos = 0x0, expected_tokens = std::vector of length 0, capacity 0, message_pos = 0x0, message = , label = , last_output_pos = 0x0, keep_previous_token = false}, recovered = false, value_stack = std::vector of length 0, capacity 0, value_stack_size = 0, rule_stack = std::vector of length 0, capacity 0, args_stack = std::vector of length 1, capacity 1 = {std::vector of length 0, capacity 0}, in_token_boundary_count = 0, whitespaceOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, in_whitespace = false, wordOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, capture_scope_stack = std::vector of length 1, capacity 1 = {std::map with 0 elements}, capture_scope_stack_size = 1, cut_stack = std::vector<bool> of length 0, capacity 0, def_count = 68, enablePackratParsing = false, cache_registered = std::vector<bool> of length 0, capacity 0, cache_success = std::vector<bool> of length 0, capacity 0, cache_values = std::map with 0 elements, tracer_enter = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x65636e6575716500, _M_const_object = 0x65636e6575716500, _M_function_pointer = 0x65636e6575716500, _M_member_pointer = (void (std::_Undefined_class::*)(class std::_Undefined_class * const)) 0x65636e6575716500, this adjustment 256}, _M_pod_data = \"\\000equence\\000\\001\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x555555568b1c <std::char_traits<char>::compare(char const*, char const*, unsigned long)+60>}, tracer_leave = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, unsigned long, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x5555555b2290 <std::_Function_handler<std::any (peg::SemanticValues&, std::any&), peg::Action::make_adaptor<peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8}>(peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8})::{lambda(auto:1&, auto:2&)#1}>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>, _M_const_object = 0x5555555b2290 <std::_Function_handler<std::any (peg::SemanticValues&, std::any&), peg::Action::make_adaptor<peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8}>(peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8})::{lambda(auto:1&, auto:2&)#1}>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>, _M_function_pointer = 0x5555555b2290 <std::_Function_handler<std::any (peg::SemanticValues&, std::any&), peg::Action::make_adaptor<peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8}>(peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8})::{lambda(auto:1&, auto:2&)#1}>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>, _M_member_pointer = (void (std::_Undefined_class::*)(class std::_Undefined_class * const)) 0x5555555b2290 <std::_Function_handler<std::any (peg::SemanticValues&, std::any&), peg::Action::make_adaptor<peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8}>(peg::ParserGenerator::setup_actions()::{lambda(peg::SemanticValues const&)#8})::{lambda(auto:1&, auto:2&)#1}>::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation)>, this adjustment 93824992617024}, _M_pod_data = \"\\220\\\"[UUU\\000\\000@\\\"[UUU\\000\"}, _M_manager = 0x0}, _M_invoker = 0x555555831458}, trace_data = std::any [no contained value], verbose_trace = false, log = {<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0xb, _M_const_object = 0xb, _M_function_pointer = 0xb, _M_member_pointer = &virtual table offset 10, this adjustment 8386676065534438915}, _M_pod_data = \"\\v\\000\\000\\000\\000\\000\\000\\000\\003nstruct\"}, _M_manager = 0x0}, _M_invoker = 0x7fffffffdd40}, next_trace_id = 0, trace_ids = std::vector of length 0, capacity 0, ignore_trace_state = false, source_line_index_init_ = {_M_once = 0}, source_line_index = std::vector of length 0, capacity 0}, dt=std::any [no contained value])	
peg::Definition::parse_core(char const*, unsigned long, peg::SemanticValues&, std::any&, char const*, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const (this=0x555555831468, s=0x5555555dbc92 \"Definition <- a / (b c) / d \", n=28, vs=@0x7fffffffde58: {<std::vector<std::any, std::allocator<std::any> >> = std::vector of length 0, capacity 0, path = 0x0, ss = 0x0, tags = std::vector of length 0, capacity 0, tokens = std::vector of length 0, capacity 0, c_ = 0x0, sv_ = \"\", choice_count_ = 0, choice_ = 0, name_ = }, dt=std::any [no contained value], path=0x0, log={<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x555555599539 <std::__detail::_Hash_node_value_base<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >::_M_valptr()+25>, _M_const_object = 0x555555599539 <std::__detail::_Hash_node_value_base<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >::_M_valptr()+25>, _M_function_pointer = 0x555555599539 <std::__detail::_Hash_node_value_base<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, peg::Definition> >::_M_valptr()+25>, _M_member_pointer = &virtual table offset 93824992515384, this adjustment 93824995248704}, _M_pod_data = \"9\\225YUUU\\000\\000@J\\203UUU\\000\"}, _M_manager = 0x0}, _M_invoker = 0x7fffffffde60})	
peg::Definition::parse(char const*, unsigned long, char const*, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const (this=0x555555831468, s=0x5555555dbc92 \"Definition <- a / (b c) / d \", n=28, path=0x0, log={<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x555555831720, _M_const_object = 0x555555831720, _M_function_pointer = 0x555555831720, _M_member_pointer = (void (std::_Undefined_class::*)(class std::_Undefined_class * const)) 0x555555831720, this adjustment 140737488347032}, _M_pod_data = \" \\027\\203UUU\\000\\000\\230\\337\\377\\377\\377\\177\\000\"}, _M_manager = 0x0}, _M_invoker = 0x6974696e69666544})	
exact (g=std::unordered_map with 70 elements, d=0x5555555dbc87 \"Definition\", s=0x5555555dbc92 \"Definition <- a / (b c) / d \")	
main (argc=1, argv=0x7fffffffe198)	

Before I was using g++:

g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-nrQql7/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~18.04) 

@mingodad
Copy link
Contributor Author

With clang15 if I use Grammar g = instead of Grammar &g = then it runs fine.
But with g++9.4.0 it fail both ways.

@mingodad
Copy link
Contributor Author

With g++-12:

gcc-12-env g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/mingo/local/gcc-12/libexec/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/home/mingo/local/gcc-12 --enable-languages=c,d,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC) 

The minimal example behaves like the clang-15 and when it fails it shows this stack trace:

__GI_raise (sig=6, sig@entry=6)	
__GI_abort ()	
?? ()	
?? ()	
std::terminate() ()	
__cxa_throw ()	
std::__throw_bad_any_cast ()	
std::any_cast<peg::ParserGenerator::Data*> (__any=std::any [no contained value])	
peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#2}::operator()(peg::Context const&, char const*, unsigned long, std::any&) const (__closure=0x6d5238, dt=std::any [no contained value])	
std::__invoke_impl<void, peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#2}&, peg::Context const&, char const*, unsigned long, std::any&>(std::__invoke_other, peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#2}&, peg::Context const&, char const*&&, unsigned long&&, std::any&) (__f=@0x6d5238: {<No data fields>})	
std::__invoke_r<void, peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#2}&, peg::Context const&, char const*, unsigned long, std::any&>(peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#2}&, peg::Context const&, char const*&&, unsigned long&&, std::any&) (__fn=@0x6d5238: {<No data fields>})	
std::_Function_handler<void (peg::Context const&, char const*, unsigned long, std::any&), peg::ParserGenerator::setup_actions()::{lambda(peg::Context const&, char const*, unsigned long, std::any&)#2}>::_M_invoke(std::_Any_data const&, peg::Context const&, char const*&&, unsigned long&&, std::any&) (__functor=@0x6d5238: {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, __args#0=@0x7fffffffda40: {path = 0x0, s = 0x47c977 \"Definition <- a / (b c) / d \", l = 28, error_info = {error_pos = 0x0, expected_tokens = std::vector of length 0, capacity 0, message_pos = 0x0, message = \"\", label = \"\", last_output_pos = 0x0, keep_previous_token = false}, recovered = false, value_stack = std::vector of length 0, capacity 0, value_stack_size = 0, rule_stack = std::vector of length 0, capacity 0, args_stack = std::vector of length 1, capacity 1 = {std::vector of length 0, capacity 0}, in_token_boundary_count = 0, whitespaceOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, in_whitespace = false, wordOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, capture_scope_stack = std::vector of length 1, capacity 1 = {std::map with 0 elements}, capture_scope_stack_size = 1, cut_stack = std::vector<bool> of length 0, capacity 0, def_count = 68, enablePackratParsing = false, cache_registered = std::vector<bool> of length 0, capacity 0, cache_success = std::vector<bool> of length 0, capacity 0, cache_values = std::map with 0 elements, tracer_enter = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, tracer_leave = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, unsigned long, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, trace_data = std::any [no contained value], verbose_trace = false, log = {<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, next_trace_id = 0, trace_ids = std::vector of length 0, capacity 0, ignore_trace_state = false, source_line_index_init_ = {_M_once = 0}, source_line_index = std::vector of length 0, capacity 0}, __args#1=@0x7fffffffd648: 0x47c977 \"Definition <- a / (b c) / d \", __args#2=@0x7fffffffd640: 28, __args#3=std::any [no contained value])	
std::function<void (peg::Context const&, char const*, unsigned long, std::any&)>::operator()(peg::Context const&, char const*, unsigned long, std::any&) const (this=0x6d5238, __args#0=@0x7fffffffda40: {path = 0x0, s = 0x47c977 \"Definition <- a / (b c) / d \", l = 28, error_info = {error_pos = 0x0, expected_tokens = std::vector of length 0, capacity 0, message_pos = 0x0, message = \"\", label = \"\", last_output_pos = 0x0, keep_previous_token = false}, recovered = false, value_stack = std::vector of length 0, capacity 0, value_stack_size = 0, rule_stack = std::vector of length 0, capacity 0, args_stack = std::vector of length 1, capacity 1 = {std::vector of length 0, capacity 0}, in_token_boundary_count = 0, whitespaceOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, in_whitespace = false, wordOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, capture_scope_stack = std::vector of length 1, capacity 1 = {std::map with 0 elements}, capture_scope_stack_size = 1, cut_stack = std::vector<bool> of length 0, capacity 0, def_count = 68, enablePackratParsing = false, cache_registered = std::vector<bool> of length 0, capacity 0, cache_success = std::vector<bool> of length 0, capacity 0, cache_values = std::map with 0 elements, tracer_enter = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, tracer_leave = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, unsigned long, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, trace_data = std::any [no contained value], verbose_trace = false, log = {<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, next_trace_id = 0, trace_ids = std::vector of length 0, capacity 0, ignore_trace_state = false, source_line_index_init_ = {_M_once = 0}, source_line_index = std::vector of length 0, capacity 0}, __args#1=0x47c977 \"Definition <- a / (b c) / d \", __args#2=28, __args#3=std::any [no contained value])	
peg::Holder::parse_core(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const::{lambda(std::any&)#1}::operator()(std::any&) const (__closure=0x7fffffffd8c0, a_val=std::any [no contained value])	
peg::Context::packrat<peg::Holder::parse_core(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const::{lambda(std::any&)#1}>(char const*, unsigned long, unsigned long&, std::any&, peg::Holder::parse_core(char const*, unsigned long, peg::SemanticValues&, peg::Context&, std::any&) const::{lambda(std::any&)#1}) (this=0x7fffffffda40, a_s=0x47c977 \"Definition <- a / (b c) / d \", def_id=0, len=@0x7fffffffd938: 68, val=std::any [no contained value], fn={__this = 0x6d53f0, __c = @0x7fffffffda40, __s = @0x7fffffffd910, __n = @0x7fffffffd908, __dt = std::any [no contained value], __len = @0x7fffffffd938})	
peg::Holder::parse_core (this=0x6d53f0, s=0x47c977 \"Definition <- a / (b c) / d \", n=28, vs=@0x7fffffffde70: {<std::vector<std::any, std::allocator<std::any> >> = std::vector of length 0, capacity 0, path = 0x0, ss = 0x0, tags = std::vector of length 0, capacity 0, tokens = std::vector of length 0, capacity 0, c_ = 0x0, sv_ = \"\", choice_count_ = 0, choice_ = 0, name_ = \"\"}, c=@0x7fffffffda40: {path = 0x0, s = 0x47c977 \"Definition <- a / (b c) / d \", l = 28, error_info = {error_pos = 0x0, expected_tokens = std::vector of length 0, capacity 0, message_pos = 0x0, message = \"\", label = \"\", last_output_pos = 0x0, keep_previous_token = false}, recovered = false, value_stack = std::vector of length 0, capacity 0, value_stack_size = 0, rule_stack = std::vector of length 0, capacity 0, args_stack = std::vector of length 1, capacity 1 = {std::vector of length 0, capacity 0}, in_token_boundary_count = 0, whitespaceOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, in_whitespace = false, wordOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, capture_scope_stack = std::vector of length 1, capacity 1 = {std::map with 0 elements}, capture_scope_stack_size = 1, cut_stack = std::vector<bool> of length 0, capacity 0, def_count = 68, enablePackratParsing = false, cache_registered = std::vector<bool> of length 0, capacity 0, cache_success = std::vector<bool> of length 0, capacity 0, cache_values = std::map with 0 elements, tracer_enter = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, tracer_leave = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, unsigned long, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, trace_data = std::any [no contained value], verbose_trace = false, log = {<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, next_trace_id = 0, trace_ids = std::vector of length 0, capacity 0, ignore_trace_state = false, source_line_index_init_ = {_M_once = 0}, source_line_index = std::vector of length 0, capacity 0}, dt=std::any [no contained value])	
peg::Ope::parse (this=0x6d53f0, s=0x47c977 \"Definition <- a / (b c) / d \", n=28, vs=@0x7fffffffde70: {<std::vector<std::any, std::allocator<std::any> >> = std::vector of length 0, capacity 0, path = 0x0, ss = 0x0, tags = std::vector of length 0, capacity 0, tokens = std::vector of length 0, capacity 0, c_ = 0x0, sv_ = \"\", choice_count_ = 0, choice_ = 0, name_ = \"\"}, c=@0x7fffffffda40: {path = 0x0, s = 0x47c977 \"Definition <- a / (b c) / d \", l = 28, error_info = {error_pos = 0x0, expected_tokens = std::vector of length 0, capacity 0, message_pos = 0x0, message = \"\", label = \"\", last_output_pos = 0x0, keep_previous_token = false}, recovered = false, value_stack = std::vector of length 0, capacity 0, value_stack_size = 0, rule_stack = std::vector of length 0, capacity 0, args_stack = std::vector of length 1, capacity 1 = {std::vector of length 0, capacity 0}, in_token_boundary_count = 0, whitespaceOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, in_whitespace = false, wordOpe = std::shared_ptr<class peg::Ope> (empty) = {get() = 0x0}, capture_scope_stack = std::vector of length 1, capacity 1 = {std::map with 0 elements}, capture_scope_stack_size = 1, cut_stack = std::vector<bool> of length 0, capacity 0, def_count = 68, enablePackratParsing = false, cache_registered = std::vector<bool> of length 0, capacity 0, cache_success = std::vector<bool> of length 0, capacity 0, cache_values = std::map with 0 elements, tracer_enter = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, tracer_leave = {<std::_Maybe_unary_or_binary_function<void, peg::Ope const&, char const*, unsigned long, peg::SemanticValues const&, peg::Context const&, std::any const&, unsigned long, std::any&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, trace_data = std::any [no contained value], verbose_trace = false, log = {<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0}, next_trace_id = 0, trace_ids = std::vector of length 0, capacity 0, ignore_trace_state = false, source_line_index_init_ = {_M_once = 0}, source_line_index = std::vector of length 0, capacity 0}, dt=std::any [no contained value])	
peg::Definition::parse_core(char const*, unsigned long, peg::SemanticValues&, std::any&, char const*, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const (this=0x6d51b8, s=0x47c977 \"Definition <- a / (b c) / d \", n=28, vs=@0x7fffffffde70: {<std::vector<std::any, std::allocator<std::any> >> = std::vector of length 0, capacity 0, path = 0x0, ss = 0x0, tags = std::vector of length 0, capacity 0, tokens = std::vector of length 0, capacity 0, c_ = 0x0, sv_ = \"\", choice_count_ = 0, choice_ = 0, name_ = \"\"}, dt=std::any [no contained value], path=0x0, log={<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0})	
peg::Definition::parse(char const*, unsigned long, char const*, std::function<void (unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const (this=0x6d51b8, s=0x47c977 \"Definition <- a / (b c) / d \", n=28, path=0x0, log={<std::_Maybe_unary_or_binary_function<void, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>> = {<No data fields>}, <std::_Function_base> = {static _M_max_size = 16, static _M_max_align = 8, _M_functor = {_M_unused = {_M_object = 0x0, _M_const_object = 0x0, _M_function_pointer = 0x0, _M_member_pointer = NULL}, _M_pod_data = \"\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\"}, _M_manager = 0x0}, _M_invoker = 0x0})	
exact (g=std::unordered_map with 70 elements, d=0x47c599 \"Definition\", s=0x47c977 \"Definition <- a / (b c) / d \")	
main (argc=1, argv=0x7fffffffe188)	

@mingodad
Copy link
Contributor Author

I've tested with g++ 8/9/10 and they fail with Grammar g = or Grammar &g =.

@mingodad
Copy link
Contributor Author

Interesting when testing with g++-9.4.0 and -m32 (for 32 bits) then I'm getting the same results as with clang15, I mean it work with Grammar g = and do not work with Grammar &g =.

@yhirose
Copy link
Owner

yhirose commented Nov 12, 2024

Fixed at #311

@yhirose yhirose closed this as completed Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants