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

new-delete-type-mismatch on GCC 14 #570

Open
ac0mplex opened this issue Nov 5, 2024 · 0 comments
Open

new-delete-type-mismatch on GCC 14 #570

ac0mplex opened this issue Nov 5, 2024 · 0 comments

Comments

@ac0mplex
Copy link

ac0mplex commented Nov 5, 2024

Expected Behavior

No issues when running the program with -fsanitize=address compiled with GCC 14

Actual Behavior

=================================================================
==12580==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x503000000040 in thread T0:
  object passed to delete has wrong type:
  size of the allocated type:   24 bytes;
  size of the deallocated type: 16 bytes.
    #0 0x7e9b3baff652 in operator delete(void*, unsigned long) /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_new_delete.cpp:164
    #1 0x5ed628a4e19c in boost::ext::di::v1_3_0::scopes::instance::scope<boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, int>::~scope() (/home/***/workspace/tmp/a.out+0x319c) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #2 0x5ed628a4dd7b in boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::instance, boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none>::~dependency() (/home/***/workspace/tmp/a.out+0x2d7b) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #3 0x5ed628a4dd97 in boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::instance, boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> > >::~pool() (/home/***/workspace/tmp/a.out+0x2d97) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #4 0x5ed628a4ddb3 in boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::instance, boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >::~injector() (/home/***/workspace/tmp/a.out+0x2db3) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #5 0x5ed628a4ddcf in boost::ext::di::v1_3_0::detail::injector<boost::ext::di::v1_3_0::config, int, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::instance, boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >::~injector() (/home/***/workspace/tmp/a.out+0x2dcf) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #6 0x5ed628a4d4cb in main (/home/***/workspace/tmp/a.out+0x24cb) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #7 0x7e9b3b434e07  (/usr/lib/libc.so.6+0x25e07) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
    #8 0x7e9b3b434ecb in __libc_start_main (/usr/lib/libc.so.6+0x25ecb) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
    #9 0x5ed628a4d1f4 in _start (/home/***/workspace/tmp/a.out+0x21f4) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)

0x503000000040 is located 0 bytes inside of 24-byte region [0x503000000040,0x503000000058)
allocated by thread T0 here:
    #0 0x7e9b3bafe4f2 in operator new(unsigned long) /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_new_delete.cpp:95
    #1 0x5ed628a4ebd8 in boost::ext::di::v1_3_0::scopes::instance::scope<boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, int>::scope<boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::singleton, Interface, Impl, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >, 0>(boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::singleton, Interface, Impl, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >&&) (/home/***/workspace/tmp/a.out+0x3bd8) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #2 0x5ed628a4ea48 in boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::instance, boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none>::dependency<boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::singleton, Interface, Impl, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> > >(boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::singleton, Interface, Impl, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >&&) (/home/***/workspace/tmp/a.out+0x3a48) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #3 0x5ed628a4e983 in boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::instance, boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >::injector<boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::singleton, Interface, Impl, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::instance, boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >(boost::ext::di::v1_3_0::core::from_injector const&, boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::singleton, Interface, Impl, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >&&, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::instance, boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> > const&) (/home/***/workspace/tmp/a.out+0x3983) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #4 0x5ed628a4e61a in boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::instance, boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::singleton, Interface, Impl, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >(boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::singleton, Interface, Impl, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >&&) (/home/***/workspace/tmp/a.out+0x361a) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #5 0x5ed628a4e0c0 in boost::ext::di::v1_3_0::detail::injector<boost::ext::di::v1_3_0::config, int, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::instance, boost::ext::di::v1_3_0::aux::type_list<Interface>, boost::ext::di::v1_3_0::aux::type_list<boost::ext::di::v1_3_0::named<boost::ext::di::v1_3_0::no_name, Interface&> >, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::singleton, Interface, Impl, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >(boost::ext::di::v1_3_0::core::injector<boost::ext::di::v1_3_0::config, boost::ext::di::v1_3_0::core::pool<boost::ext::di::v1_3_0::aux::type_list<> >, boost::ext::di::v1_3_0::core::dependency<boost::ext::di::v1_3_0::scopes::singleton, Interface, Impl, boost::ext::di::v1_3_0::no_name, void, boost::ext::di::v1_3_0::core::none> >&&) (/home/***/workspace/tmp/a.out+0x30c0) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #6 0x5ed628a4d3af in make_injector() (/home/***/workspace/tmp/a.out+0x23af) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #7 0x5ed628a4d4b9 in main (/home/***/workspace/tmp/a.out+0x24b9) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)
    #8 0x7e9b3b434e07  (/usr/lib/libc.so.6+0x25e07) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
    #9 0x7e9b3b434ecb in __libc_start_main (/usr/lib/libc.so.6+0x25ecb) (BuildId: 98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
    #10 0x5ed628a4d1f4 in _start (/home/***/workspace/tmp/a.out+0x21f4) (BuildId: 5447c4fded6d61cbab90528a9d99fc064de0ad01)

SUMMARY: AddressSanitizer: new-delete-type-mismatch /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_new_delete.cpp:164 in operator delete(void*, unsigned long)
==12580==HINT: if you don't care about these errors you may set ASAN_OPTIONS=new_delete_type_mismatch=0
==12580==ABORTING

Steps to Reproduce the Problem

Compile the following program on gcc 14.2.1 with g++ -fsanitize=address main.cpp:

#include "boost/di.hpp"

struct Interface{
        virtual ~Interface() = default;
};
struct Impl : public Interface {};

boost::di::injector<Interface&> make_injector() {
        return boost::di::make_injector(
                boost::di::bind<Interface>().to<Impl>().in(boost::di::singleton)
        );
}

int main()
{
        auto injector = make_injector();
        return 0;
}

Specifications

  • Version: 1.3.0
  • Platform: Linux
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