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

Crash on startup with failing debug assert #254

Open
jonesmz opened this issue Nov 20, 2023 · 4 comments
Open

Crash on startup with failing debug assert #254

jonesmz opened this issue Nov 20, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@jonesmz
Copy link
Member

jonesmz commented Nov 20, 2023

1  ??                                                                                                               0x7ffff6eaea1c 
2  raise                                                                                                            0x7ffff6e60486 
3  abort                                                                                                            0x7ffff6e49877 
4  std::__glibcxx_assert_fail                                                           debug.cc                61  0x7ffff7121d3f 
5  std::unique_ptr<unsigned long [], std::default_delete<unsigned long []>>::operator[] unique_ptr.h            724 0x55555559cbfc 
6  lgrn::HierarchicalBitset<unsigned long>::resize                                      hierarchical_bitset.hpp 471 0x5555555c972c 
7  lgrn::IdRegistry<osp::PkgId, false>::reserve                                         registry.hpp            69  0x5555555cd06c 
8  lgrn::IdRegistry<osp::PkgId, false>::create<osp::PkgId *>                            registry.hpp            109 0x5555555cb30f 
9  lgrn::IdRegistry<osp::PkgId, false>::create                                          registry.hpp            38  0x5555555c9ec6 
10 osp::Resources::pkg_create                                                           Resources.cpp           111 0x5555555c8d33 
11 load_a_bunch_of_stuff                                                                main.cpp                368 0x555555734c2f 
12 main                                                                                 main.cpp                150 0x555555733755 

@jonesmz
Copy link
Member Author

jonesmz commented Nov 20, 2023


    constexpr HierarchicalBitset() = default;

    /**
     * @brief Construct with size
     *
     * @param size [in] Size in bits
     * @param fill [in] Initialize with 1 bits if true
     */
    HierarchicalBitset(std::size_t size, bool fill = false)
     : m_size{size}
     , m_topLevel{0}
     , m_blockCount{ calc_blocks_recurse(size, 0, m_topLevel, m_rows) }
     , m_blocks{ std::make_unique<BLOCK_INT_T[]>(m_blockCount) }
    {
        if (fill)
        {
            set();
        }
    }

lgrn::HierarchicalBitset has a parameterized constructor, but also a default constructor.

In the default constructor, the std::unique_ptr isn't given a buffer, but the rest of the functions of the class assume it has something.

@jonesmz
Copy link
Member Author

jonesmz commented Nov 20, 2023

Removing the default constructor and changing the parameterized constructor to

    HierarchicalBitset(std::size_t size = 0, bool fill = false)

(Set the size variable to 0 by default)

gets past the crash.

@Capital-Asterisk
Copy link
Contributor

Is the longeron++ submodule up to date? I'm pretty sure I fixed this already and updated the submodule.

Capital-Asterisk/longeronpp#16

I forgot where exactly, but it's not suppose to be calling the default constructor at all, so changing the constructor there would likely cause an error elsewhere

@jonesmz
Copy link
Member Author

jonesmz commented Nov 21, 2023

my local source checkout is on commit 1f8b0715fd4e7bb36811acd2636539c9f9e43f88 of longeronpp

@Capital-Asterisk Capital-Asterisk added the bug Something isn't working label May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants