pcbnew assertion failure when using walk-around routing with rounded track corners
Description
Using the walk-around mode of the router, enabling the rounded track corner mode and then jiggling the trace around an obstacle triggers an assertion failure.
9c579c1d-18eb-43f3-bf08-f59b29df498f
Backtrace:
/usr/include/c++/13.2.1/bits/stl_vector.h:1144: std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = std::pair<long int, long int>; _Alloc = std::allocator<std::pair<long int, long int> >; const_reference = const std::pair<long int, long int>&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Thread 1 "kicad" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
Downloading source file /usr/src/debug/glibc/glibc/nptl/pthread_kill.c
44 return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
(gdb) bt
#0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1 0x00007ffff4b80393 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2 0x00007ffff4b2f6c8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x00007ffff4b174b8 in __GI_abort () at abort.c:79
#4 0x00007ffff4ec33b2 in std::__glibcxx_assert_fail
(file=file@entry=0x7fffe682b728 "/usr/include/c++/13.2.1/bits/stl_vector.h", line=line@entry=1144, function=function@entry=0x7fffe683c370 "std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = std::pair<long int, long int>; _Alloc = std::allocator<std::pair<long int, long int> >; cons"..., condition=condition@entry=0x7fffe67f08c8 "__n < this->size()")
at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/debug.cc:61
#5 0x00007fffe5706edc in std::vector<std::pair<long, long>, std::allocator<std::pair<long, long> > >::operator[] (this=<optimized out>, __n=<optimized out>) at /usr/include/c++/13.2.1/bits/stl_vector.h:1144
#6 SHAPE_LINE_CHAIN::ArcIndex (this=<optimized out>, aSegment=<optimized out>) at /usr/src/debug/kicad-nightly/kicad/libs/kimath/include/geometry/shape_line_chain.h:805
#7 0x00007fffe6475ec2 in SHAPE_LINE_CHAIN::Slice (this=0x55555f8b7f50, aStartIndex=<optimized out>, aEndIndex=11) at /usr/src/debug/kicad-nightly/kicad/libs/kimath/src/geometry/shape_line_chain.cpp:1181
#8 0x00007fffe5fce733 in PNS::LINE_PLACER::optimizeTailHeadTransition (this=this@entry=0x55555f8b7dd0) at /usr/src/debug/kicad-nightly/kicad/pcbnew/router/pns_line_placer.cpp:1050
#9 0x00007fffe5fd06ec in PNS::LINE_PLACER::routeStep (this=this@entry=0x55555f8b7dd0, aP=...) at /usr/src/debug/kicad-nightly/kicad/pcbnew/router/pns_line_placer.cpp:1181
#10 0x00007fffe5fd3de7 in PNS::LINE_PLACER::route (aP=..., this=0x55555f8b7dd0) at /usr/src/debug/kicad-nightly/kicad/pcbnew/router/pns_line_placer.cpp:1202
#11 PNS::LINE_PLACER::Move (this=0x55555f8b7dd0, aP=..., aEndItem=0x0) at /usr/src/debug/kicad-nightly/kicad/pcbnew/router/pns_line_placer.cpp:1476
#12 0x00007fffe5f85aba in PNS::ROUTER::movePlacing (this=0x55555fb6f7f0, aP=..., aEndItem=0x0) at /usr/src/debug/kicad-nightly/kicad/pcbnew/router/pns_router.cpp:736
#13 0x00007fffe5fa2f8c in ROUTER_TOOL::performRouting (this=this@entry=0x555556b4e0a0) at /usr/src/debug/kicad-nightly/kicad/pcbnew/router/router_tool.cpp:1352
#14 0x00007fffe5fa7664 in ROUTER_TOOL::MainLoop (this=0x555556b4e0a0, aEvent=...) at /usr/src/debug/kicad-nightly/kicad/pcbnew/router/router_tool.cpp:1821
#15 0x00007fffe6185a70 in std::function<int (TOOL_EVENT const&)>::operator()(TOOL_EVENT const&) const (__args#0=<optimized out>, this=0x55555fa1b478) at /usr/include/c++/13.2.1/bits/std_function.h:591
#16 COROUTINE<int, TOOL_EVENT const&>::callerStub (aData=<optimized out>) at /usr/src/debug/kicad-nightly/kicad/include/tool/coroutine.h:509
#17 0x00007fffe67ee431 in make_fcontext () at /usr/lib/kicad-nightly/bin/_pcbnew.kiface
#18 0x0000000000000000 in ??? ()
Steps to reproduce
- Create a board where the router will walk around an obstacle (e.g. just a single resistor as in the video)
- Switch the corner mode to the first rounding mode (i.e. press Ctrl-/ once)
- Start routing from one pad and then jiggle the trace around a little
KiCad Version
Application: KiCad x86_64 on x86_64
Version: 8.0.0-rc3-61-gb352b1484f-dirty, release build
Libraries:
wxWidgets 3.2.4
FreeType 2.13.2
HarfBuzz 8.3.0
FontConfig 2.15.0
libcurl/8.6.0 OpenSSL/3.2.1 zlib/1.3.1 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 libssh2/1.11.0 nghttp2/1.59.0 nghttp3/1.2.0
Platform: Arch Linux, 64 bit, Little endian, wxGTK, X11, , tty
Build Info:
Date: Feb 24 2024 15:14:43
wxWidgets: 3.2.4 (wchar_t,wx containers) GTK+ 3.24
Boost: 1.83.0
OCC: 7.7.2
Curl: 8.6.0
ngspice: 42
Compiler: GCC 13.2.1 with C++ ABI 1018
Build settings:
KICAD_USE_EGL=ON
(built from https://aur.archlinux.org/cgit/aur.git/commit/PKGBUILD?h=kicad-nightly&id=aa02730c9859930865092e0edc16a7b987889dde, the -dirty
is only because of the patches in the PKGBUILD, which don't touch the source code)