Skip to content

Stack Overflow with Namespaced Subclasses #616

@JustAPerson

Description

@JustAPerson

I was trying to bind a large C++ header of mine, and autocxx segfaulted. I've used creduce to get the following sample test case. I'm not sure if this is the same bug as #599. Please let me know if I should move this issue to the the upstream bindgen repo instead or if there's any other information I can provide.

C++

namespace N {
template <typename> class B{};
template <typename c> class C {
public:
  using U = B<c>;
};
}
class A : N::C<A> {
  U u;
};

Rust

use autocxx::include_cpp;
include_cpp! {
    #include "Sample.h"
    safety!(unsafe_ffi)
    generate!("A")
}
fn main() {}

Segmentation fault due to stack overflowing
Backtrace from coredump:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000056056427f3c7 in core::ptr::const_ptr::<impl *const [T]>::as_ptr (self=<error reading variable: Cannot access memory at address 0x7ffef0d81ff8>) at /rustc/aa8f2d432b23575929a48f87b8746f41ba723318/library/core/src/ptr/const_ptr.rs:936
#1  0x0000560564222a18 in <usize as core::slice::index::SliceIndex<[T]>>::get_unchecked (self=57, slice=...) at /rustc/aa8f2d432b23575929a48f87b8746f41ba723318/library/core/src/slice/index.rs:172
#2  0x0000560564222c67 in <usize as core::slice::index::SliceIndex<[T]>>::get (self=57, slice=...) at /rustc/aa8f2d432b23575929a48f87b8746f41ba723318/library/core/src/slice/index.rs:157
#3  0x000056056427fee7 in core::slice::<impl [T]>::get (self=..., index=57) at /rustc/aa8f2d432b23575929a48f87b8746f41ba723318/library/core/src/slice/mod.rs:304
#4  0x0000560564368b91 in autocxx_bindgen::ir::context::BindgenContext::resolve_item_fallible (self=0x7ffef6d67a10, id=...) at /home/jpriest/.cargo/registry/src/github.com-1ecc6299db9ec823/autocxx-bindgen-0.59.2/src/ir/context.rs:1462
#5  0x00005605643690b4 in autocxx_bindgen::ir::context::BindgenContext::resolve_item (self=0x7ffef6d67a10, item_id=...) at /home/jpriest/.cargo/registry/src/github.com-1ecc6299db9ec823/autocxx-bindgen-0.59.2/src/ir/context.rs:1470
#6  0x0000560564373685 in autocxx_bindgen::ir::context::ItemResolver::resolve (self=..., ctx=0x7ffef6d67a10) at /home/jpriest/.cargo/registry/src/github.com-1ecc6299db9ec823/autocxx-bindgen-0.59.2/src/ir/context.rs:2727
#7  0x00005605642cdbec in autocxx_bindgen::ir::item::Item::is_constified_enum_module (self=0x56056653a040, ctx=0x7ffef6d67a10) at /home/jpriest/.cargo/registry/src/github.com-1ecc6299db9ec823/autocxx-bindgen-0.59.2/src/ir/item.rs:1001
#8  0x00005605642cddb5 in autocxx_bindgen::ir::item::Item::is_constified_enum_module (self=0x56056653a040, ctx=0x7ffef6d67a10) at /home/jpriest/.cargo/registry/src/github.com-1ecc6299db9ec823/autocxx-bindgen-0.59.2/src/ir/item.rs:1019
#9  0x00005605642cddb5 in autocxx_bindgen::ir::item::Item::is_constified_enum_module (self=0x56056653a040, ctx=0x7ffef6d67a10) at /home/jpriest/.cargo/registry/src/github.com-1ecc6299db9ec823/autocxx-bindgen-0.59.2/src/ir/item.rs:1019
#10 0x00005605642cddb5 in autocxx_bindgen::ir::item::Item::is_constified_enum_module (self=0x56056653a040, ctx=0x7ffef6d67a10) at /home/jpriest/.cargo/registry/src/github.com-1ecc6299db9ec823/autocxx-bindgen-0.59.2/src/ir/item.rs:1019
[infinitely repeating]

Specifications

  • Version: autocxx git revision 390f2cc
  • Platform: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions