Comment 8 for bug 1789283

Aimylios (aimylios) wrote :

I have made a local build and gave gdb another shot. Fortunately it doesn't crash and this is the backtrace I get:

---

/usr/include/c++/8/bits/stl_vector.h:932: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp, _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n < this->size(), true)' failed.

Thread 1 "kicad" received signal SIGABRT, Aborted.
0x00007ffff375afeb in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff375afeb in raise () at /lib64/libc.so.6
#1 0x00007ffff37455c1 in abort () at /lib64/libc.so.6
#2 0x00007fffcad12120 in std::__replacement_assert(char const*, int, char const*, char const*) (__file=0x7fffcb5ed0c0 "/usr/include/c++/8/bits/stl_vector.h", __line=932, __function=0x7fffcb5ed2e0 <std::vector<int, std::allocator<int> >::operator[](unsigned long)::__PRETTY_FUNCTION__> "std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp, _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&;"..., __condition=0x7fffcb5ed090 "__builtin_expect(__n < this->size(), true)")
    at /usr/include/c++/8/x86_64-redhat-linux/bits/c++config.h:2389
#3 0x00007fffcae3a409 in std::vector<int, std::allocator<int> >::operator[](unsigned long) (this=0x2e05820, __n=0) at /usr/include/c++/8/bits/stl_vector.h:932
#4 0x00007fffcaef1fbe in AR_AUTOPLACER::propagate() (this=0x2e05c60) at /home/xxx/kicad/pcbnew/autorouter/ar_autoplacer.cpp:241
#5 0x00007fffcaef1d53 in AR_AUTOPLACER::genPlacementRoutingMatrix() (this=0x2e05c60) at /home/xxx/kicad/pcbnew/autorouter/ar_autoplacer.cpp:167
#6 0x00007fffcaef4091 in AR_AUTOPLACER::AutoplaceModules(std::vector<MODULE*, std::allocator<MODULE*> >, BOARD_COMMIT*, bool) (this=0x2e05c60, aModules=std::vector of length 0, capacity 0,
    aCommit=0x2e05c00, aPlaceOffboardModules=true) at /home/xxx/kicad/pcbnew/autorouter/ar_autoplacer.cpp:889
#7 0x00007fffcaef9012 in AUTOPLACE_TOOL::autoplace(std::vector<MODULE*, std::allocator<MODULE*> >&, bool) (this=0x34636d0, aModules=std::vector of length 0, capacity 0, aPlaceOffboard=true)
    at /home/xxx/kicad/pcbnew/autorouter/autoplacer_tool.cpp:87
#8 0x00007fffcaef9301 in AUTOPLACE_TOOL::autoplaceOffboard(TOOL_EVENT const&) (this=0x34636d0, aEvent=...) at /home/xxx/kicad/pcbnew/autorouter/autoplacer_tool.cpp:116
#9 0x00007fffcaefc1f8 in std::__invoke_impl<int, int (AUTOPLACE_TOOL::*&)(TOOL_EVENT const&), AUTOPLACE_TOOL*&, TOOL_EVENT const&>(std::__invoke_memfun_deref, int (AUTOPLACE_TOOL::*&)(TOOL_EVENT const&), AUTOPLACE_TOOL*&, TOOL_EVENT const&) (__f=
    @0x2c046b0: (int (AUTOPLACE_TOOL::*)(AUTOPLACE_TOOL * const, const TOOL_EVENT &)) 0x7fffcaef92cc <AUTOPLACE_TOOL::autoplaceOffboard(TOOL_EVENT const&)>, __t=@0x2c046c0: 0x34636d0, __args#0=...) at /usr/include/c++/8/bits/invoke.h:73
#10 0x00007fffcaefc029 in std::__invoke<int (AUTOPLACE_TOOL::*&)(TOOL_EVENT const&), AUTOPLACE_TOOL*&, TOOL_EVENT const&>(int (AUTOPLACE_TOOL::*&)(TOOL_EVENT const&), AUTOPLACE_TOOL*&, TOOL_EVENT const&) (__fn=
    @0x2c046b0: (int (AUTOPLACE_TOOL::*)(AUTOPLACE_TOOL * const, const TOOL_EVENT &)) 0x7fffcaef92cc <AUTOPLACE_TOOL::autoplaceOffboard(TOOL_EVENT const&)>, __args#0=@0x2c046c0: 0x34636d0, __args#1=...) at /usr/include/c++/8/bits/invoke.h:95
#11 0x00007fffcaefbd73 in std::_Bind<int (AUTOPLACE_TOOL::*(AUTOPLACE_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)>::__call<int, TOOL_EVENT const&, 0ul, 1ul>(std::tuple<TOOL_EVENT const&>&&, std::_Index_tuple<0ul, 1ul>) (this=0x2c046b0, __args=...) at /usr/include/c++/8/functional:400
#12 0x00007fffcaefb96d in std::_Bind<int (AUTOPLACE_TOOL::*(AUTOPLACE_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)>::operator()<TOOL_EVENT const&, int>(TOOL_EVENT const&) (this=0x2c046b0, __args#0=...) at /usr/include/c++/8/functional:484
#13 0x00007fffcaefb1af in std::_Function_handler<int (TOOL_EVENT const&), std::_Bind<int (AUTOPLACE_TOOL::*(AUTOPLACE_TOOL*, std::_Placeholder<1>))(TOOL_EVENT const&)> >::_M_invoke(std::_Any_data const&, TOOL_EVENT const&) (__functor=..., __args#0=...) at /usr/include/c++/8/bits/std_function.h:282
#14 0x00007fffcb495587 in std::function<int (TOOL_EVENT const&)>::operator()(TOOL_EVENT const&) const (this=0x3301798, __args#0=...) at /usr/include/c++/8/bits/std_function.h:687
#15 0x00007fffcb4926de in COROUTINE<int, TOOL_EVENT const&>::callerStub(long) (aData=140737488340752) at /home/xxx/kicad/include/tool/coroutine.h:329
#16 0x00007fffcb4ebe21 in make_fcontext () at /home/xxx/software/test/usr/local/bin/_pcbnew.kiface
#17 0x0000000002e05e00 in ()
#18 0x0000000000000000 in ()

---

As far as I understand, it points to line 241 of ar_autoplacer.cpp [1]. I guess the crash has something to do with pt_cell_V.

I also verified that the crash does not happen without _GLIBCXX_ASSERTIONS, confirming my previous assumptions.

[1] https://git.launchpad.net/kicad/tree/pcbnew/autorouter/ar_autoplacer.cpp?id=0ac96d177cc1eb39c0a6a0aa99396a6619b299e1#n241