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

Leak when a source file starts with an A #613

Open
SuperFola opened this issue Feb 21, 2024 · 0 comments
Open

Leak when a source file starts with an A #613

SuperFola opened this issue Feb 21, 2024 · 0 comments

Comments

@SuperFola
Copy link

SuperFola commented Feb 21, 2024

Expected Behavior

No leak

Actual Behavior

Using clang 15, C++20

Suite 'VM': all tests passed (0 asserts in 0 tests)
Suite 'global': all tests passed (0 asserts in 0 tests)

=================================================================
==2848390==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x558314926aad in operator new(unsigned long) (/home/fola/Code/Ark/build/unittests+0x1c5aad) (BuildId: dff9939b71b92faac21514a510a516dc0ac420c1)
    #1 0x55831494deb4 in std::__new_allocator<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/new_allocator.h:137:27
    #2 0x55831494ddea in std::allocator<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>>::allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/allocator.h:188:32
    #3 0x55831494ddea in std::allocator_traits<std::allocator<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>>>::allocate(std::allocator<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
    #4 0x55831494d3eb in std::_Vector_base<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>, std::allocator<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>>>::_M_allocate(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:378:20
    #5 0x55831494bd09 in void std::vector<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>, std::allocator<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>>>::_M_realloc_insert<void (*&)(), std::basic_string_view<char, std::char_traits<char>>&>(__gnu_cxx::__normal_iterator<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>*, std::vector<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>, std::allocator<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>>>>, void (*&)(), std::basic_string_view<char, std::char_traits<char>>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/vector.tcc:453:33
    #6 0x55831494b757 in std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>& std::vector<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>, std::allocator<std::pair<void (*)(), std::basic_string_view<char, std::char_traits<char>>>>>::emplace_back<void (*&)(), std::basic_string_view<char, std::char_traits<char>>&>(void (*&)(), std::basic_string_view<char, std::char_traits<char>>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/vector.tcc:123:4
    #7 0x55831494afcf in auto boost::ext::ut::v2_0_1::runner<boost::ext::ut::v2_0_1::reporter_junit<boost::ext::ut::v2_0_1::printer>, 16>::on<void (*)()>(boost::ext::ut::v2_0_1::events::suite<void (*)()>) /home/fola/Code/Ark/lib/ut/include/boost/ut.hpp:2046:13
    #8 0x55831494acbb in decltype(auto) boost::ext::ut::v2_0_1::detail::on<void (*)(), boost::ext::ut::v2_0_1::events::suite<void (*)()>>(boost::ext::ut::v2_0_1::events::suite<void (*)()>&&) /home/fola/Code/Ark/lib/ut/include/boost/ut.hpp:2244:73
    #9 0x55831492a50a in boost::ext::ut::v2_0_1::suite<boost::ext::ut::v2_0_1::fixed_string<char, 6ul>{char [7]{(char)80, (char)97, (char)114, (char)115, (char)101, (char)114}}>::suite<$_0>($_0) /home/fola/Code/Ark/lib/ut/include/boost/ut.hpp:3035:5
    #10 0x5583148628e3 in __cxx_global_var_init.85 /home/fola/Code/Ark/tests/unittests/AParser.cpp:46:36
    #11 0x55831486290e in _GLOBAL__sub_I_AParser.cpp /home/fola/Code/Ark/tests/unittests/AParser.cpp
    #12 0x7f41ab246375 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x27375) (BuildId: 82ce4e6e4ef08fa58a3535f7437bd3e592db5ac0)

If I rename AParser.cpp (the file, not the suite name) to Parser.cpp or aParser.cpp, it works fine.

Steps to Reproduce the Problem

  1. multiple test files under tests/ with:
#include <boost/ut.hpp>
boost::ut::suite<"test name here"> test_name_here = [] {};
  1. simple tests/main.cpp:
#include <boost/ut.hpp>
int main() {
    boost::ut::cfg<boost::ut::override> = { .filter = "*" };
    return boost::ut::cfg<boost::ut::override>.run();
}
  1. cmakelists:
file(GLOB_RECURSE UT_SOURCES tests/*.cpp)
add_executable(unittests ${UT_SOURCES})
add_subdirectory(lib/ut)
target_link_libraries(unittests PUBLIC ut)
# to avoid using import keyword
add_compile_definitions(BOOST_UT_DISABLE_MODULE)
target_compile_features(unittests PRIVATE cxx_std_20)
# file from https://github.com/ArkScript-lang/Ark/blob/dev/cmake/sanitizers.cmake
include(cmake/sanitizers.cmake)
add_address_sanitizer()
add_undefined_sanitizer()

Specifications

  • Version: master
  • Platform: debian 11, clang 15
  • Subsystem:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant