Netlist generation - Assertion failed

Bug #1168753 reported by Pekka Harjamäki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Lorenzo Marcantonio

Bug Description

Trying to generate netlist from schematics editor causes assertion failure:

ASSERT INFO:
/usr/include/wx-2.9/wx/strvararg.h(453): assert "(argtype & (wxFormatStringSpecifier<T>::value)) == argtype" failed in wxArgNormalizer(): format specifier doesn't match argument type

BACKTRACE:
[1] wxOnAssert(char const*, int, char const*, char const*, char const*)
[2] wxArgNormalizer<unsigned long>::wxArgNormalizer(unsigned long, wxFormatString const*, unsigned int)
[3] wxArgNormalizerWchar<unsigned long>::wxArgNormalizerWchar(unsigned long, wxFormatString const*, unsigned int)
[4] wxString wxString::Format<unsigned long>(wxFormatString const&, unsigned long)
[5] SCH_EDIT_FRAME::BuildNetListBase()
[6] SCH_EDIT_FRAME::CreateNetlist(int, wxString const&, unsigned int)
[7] NETLIST_DIALOG::GenNetlist(wxCommandEvent&)
[8] wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
[9] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[10] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[11] wxEvtHandler::ProcessEventLocally(wxEvent&)
[12] wxEvtHandler::ProcessEvent(wxEvent&)
[13] wxWindowBase::TryAfter(wxEvent&)
[14] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[15] g_signal_emit_valist
[16] g_signal_emit
[17] g_signal_emit_valist
[18] g_signal_emit
[19] g_closure_invoke
[20] g_signal_emit_valist
[21] g_signal_emit
[22] gtk_propagate_event
[23] gtk_main_do_event
[24] g_main_context_dispatch
[25] g_main_loop_run
[26] gtk_main
[27] wxGUIEventLoop::Run()
[28] wxDialog::ShowModal()
[29] SCH_EDIT_FRAME::OnCreateNetlist(wxCommandEvent&)
[30] wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
[31] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[32] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[33] EDA_BASE_FRAME::ProcessEvent(wxEvent&)
[34] wxEvtHandler::DoTryChain(wxEvent&)
[35] wxEvtHandler::ProcessEvent(wxEvent&)
[36] wxWindowBase::TryAfter(wxEvent&)
[37] wxAuiToolBar::OnLeftUp(wxMouseEvent&)
[38] wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
[39] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[40] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[41] wxEvtHandler::ProcessEventLocally(wxEvent&)
[42] wxEvtHandler::ProcessEvent(wxEvent&)
[43] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[44] g_closure_invoke
[45] g_signal_emit_valist
[46] g_signal_emit
[47] gtk_propagate_event
[48] gtk_main_do_event
[49] g_main_context_dispatch
[50] g_main_loop_run
[51] gtk_main

i have attached my project as zipfile. I'm using kicad bzr 4094 compiled with gcc 4.7.2. wxGTK version is 2.9.4.1

Revision history for this message
Pekka Harjamäki (spamtrap-lpad) wrote :
Revision history for this message
Lorenzo Marcantonio (l-marcantonio) wrote : Re: [Bug 1168753] [NEW] Netlist generation - Assertion failed

On Sat, Apr 13, 2013 at 08:53:28PM -0000, Pekka Harjamäki wrote:

Tried it, and for me it works... however the only format which plausibly
go wrong in BuildNetListBase is this

activity += wxString::Format( _( " net count = %u" ),
g_NetObjectslist.size() );

From the backtrace it seems that it got an unsigned long from size() and
choke on that... is your system 32 or 64 bits? I hope is 32 because
otherwise I have no explanation...

IIRC STL uses size_t for the size() return values, maybe that's the
difference... you could try replacing the %u with %z; I don't know if wx
supports it. Otherwise try with %lu (but then maybe a cast will be
needed for safely work on the other architecture).

--
Lorenzo Marcantonio
Logos Srl

Changed in kicad:
status: New → Incomplete
importance: Undecided → High
assignee: nobody → Lorenzo Marcantonio (l-marcantonio)
Revision history for this message
Pekka Harjamäki (spamtrap-lpad) wrote :

uname -a output:

Linux 3.8.0-sabayon #1 SMP Fri Mar 29 13:54:29 UTC 2013 x86_64 Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz GenuineIntel GNU/Linux

so.. 64-bit system.. sorry :)

Revision history for this message
Pekka Harjamäki (spamtrap-lpad) wrote :

Changing line 149 (activity+=......) to this:

activity += wxString::Format( _( " net count = %z" ), g_NetObjectslist.size() );

caused this:

ASSERT INFO:
/var/tmp/portage/x11-libs/wxGTK-2.9.4.1/work/wxPython-src-2.9.4.0/src/common/strvararg.cpp(659): assert "n <= parser.nargs" failed in DoGetArgumentType(): more arguments than format string specifiers?

BACKTRACE:
[1] wxOnAssert(char const*, int, char const*, char const*, char const*)
[2] wxArgNormalizer<unsigned long>::wxArgNormalizer(unsigned long, wxFormatString const*, unsigned int)
[3] wxArgNormalizerWchar<unsigned long>::wxArgNormalizerWchar(unsigned long, wxFormatString const*, unsigned int)
[4] wxString wxString::Format<unsigned long>(wxFormatString const&, unsigned long)
[5] SCH_EDIT_FRAME::BuildNetListBase()
[6] SCH_EDIT_FRAME::CreateNetlist(int, wxString const&, unsigned int)
[7] NETLIST_DIALOG::GenNetlist(wxCommandEvent&)
[8] wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
[9] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[10] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[11] wxEvtHandler::ProcessEventLocally(wxEvent&)
[12] wxEvtHandler::ProcessEvent(wxEvent&)
[13] wxWindowBase::TryAfter(wxEvent&)
[14] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[15] g_signal_emit_valist
[16] g_signal_emit
[17] g_signal_emit_valist
[18] g_signal_emit
[19] g_closure_invoke
[20] g_signal_emit_valist
[21] g_signal_emit
[22] gtk_propagate_event
[23] gtk_main_do_event
[24] g_main_context_dispatch
[25] g_main_loop_run
[26] gtk_main
[27] wxGUIEventLoop::Run()
[28] wxDialog::ShowModal()
[29] SCH_EDIT_FRAME::OnCreateNetlist(wxCommandEvent&)
[30] wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
[31] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[32] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[33] EDA_BASE_FRAME::ProcessEvent(wxEvent&)
[34] wxEvtHandler::DoTryChain(wxEvent&)
[35] wxEvtHandler::ProcessEvent(wxEvent&)
[36] wxWindowBase::TryAfter(wxEvent&)
[37] wxAuiToolBar::OnLeftUp(wxMouseEvent&)
[38] wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const
[39] wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&)
[40] wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*)
[41] wxEvtHandler::ProcessEventLocally(wxEvent&)
[42] wxEvtHandler::ProcessEvent(wxEvent&)
[43] wxEvtHandler::SafelyProcessEvent(wxEvent&)
[44] g_closure_invoke
[45] g_signal_emit_valist
[46] g_signal_emit
[47] gtk_propagate_event
[48] gtk_main_do_event
[49] g_main_context_dispatch
[50] g_main_loop_run
[51] gtk_main

Revision history for this message
Pekka Harjamäki (spamtrap-lpad) wrote :

Changing the line to this seems to work:

activity += wxString::Format( _( " net count = %lu" ), g_NetObjectslist.size() );

Revision history for this message
Lorenzo Marcantonio (l-marcantonio) wrote : Re: [Bug 1168753] Re: Netlist generation - Assertion failed

On Sun, Apr 14, 2013 at 06:08:10AM -0000, Pekka Harjamäki wrote:
> Changing line 149 (activity+=......) to this:
>
> activity += wxString::Format( _( " net count = %z" ),
> g_NetObjectslist.size() );

Definitely not supported, given the error...

I *hate* wx when does this... it all depends on its compilation options.

Anyway I'll use the long with a cast for good measure, just to be sure.

--
Lorenzo Marcantonio
Logos Srl

Changed in kicad:
status: Incomplete → Fix Committed
Revision history for this message
Dick Hollenbeck (dickelbeck) wrote :

not %z but rather %zu
Is worth a try.
 On Apr 14, 2013 3:35 AM, "Lorenzo Marcantonio" <email address hidden>
wrote:

> ** Changed in: kicad
> Status: Incomplete => Fix Committed
>
> --
> You received this bug notification because you are a member of KiCad Bug
> Squad, which is subscribed to KiCad.
> https://bugs.launchpad.net/bugs/1168753
>
> Title:
> Netlist generation - Assertion failed
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1168753/+subscriptions
>

Revision history for this message
Pekka Harjamäki (spamtrap-lpad) wrote :

Both %lu and %zu seem to be working.

Revision history for this message
Lorenzo Marcantonio (l-marcantonio) wrote :

On Sun, Apr 14, 2013 at 09:22:10AM -0000, Dick Hollenbeck wrote:
> not %z but rather %zu

Thanks for the correction, my fault. z is the modifier, not the type letter!
If it works it should be better than %lu with the cast.

--
Lorenzo Marcantonio
Logos Srl

Revision history for this message
Dick Hollenbeck (dickelbeck) wrote :

%ld or % lu is incorrect on 32 bit systems. I was not actually guessing
when I said %zu.
On Apr 14, 2013 4:55 AM, "Pekka Harjamäki" <email address hidden> wrote:

> Both %lu and %zu seem to be working.
>
> --
> You received this bug notification because you are a member of KiCad Bug
> Squad, which is subscribed to KiCad.
> https://bugs.launchpad.net/bugs/1168753
>
> Title:
> Netlist generation - Assertion failed
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1168753/+subscriptions
>

Revision history for this message
Lorenzo Marcantonio (l-marcantonio) wrote :

On Sun, Apr 14, 2013 at 01:36:09PM -0000, Dick Hollenbeck wrote:
> %ld or % lu is incorrect on 32 bit systems. I was not actually guessing
> when I said %zu.

Yes, that's the reason why I asked the platform before... I didn't
remember that the 'z' was a modifier and not the type letter.

However it's possible that it happened before since in one of the
3 formats in cvpcb there was an explicit int cast (used with %d).
Technically the right thing should be %zu, I agree.

--
Lorenzo Marcantonio
Logos Srl

Jon Neal (reportingsjr)
Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.