Closed in3otd closed 9 years ago
I am getting this backtrace from the debugger:
~/git/qucs/qucs-core $ lldb -- /Users/guitorri/local/qucs-devel/bin/qucsator -i /Users/guitorri/qucs_area/netlist.txt
(lldb) target create "/Users/guitorri/local/qucs-devel/bin/qucsator"
Current executable set to '/Users/guitorri/local/qucs-devel/bin/qucsator' (x86_64).
(lldb) settings set -- target.run-args "-i" "/Users/guitorri/qucs_area/netlist.txt"
(lldb) r
Process 41644 launched: '/Users/guitorri/local/qucs-devel/bin/qucsator' (x86_64)
project location:
modules to load: 0
factorycreate.size() is 0
factorycreate has registered:
parsing netlist...
checking netlist...
checker notice, variable `S' in equation `dB_S21' not yet defined
checker notice, variable `S' in equation `Rin' not yet defined
checker notice, variable `S' in equation `Xin' not yet defined
< clip >
NOTIFY: SP1: preparing circuit for analysis
NOTIFY: SP1: inserted 2 tees, 1 crosses, 0 opens and 4 grounds
NOTIFY: SP1: creating sorted nodelist for SP analysis
NOTIFY: SP1: solving SP netlist
Process 41622 stopped
* thread #1: tid = 0x45952, 0x000000010005dd9a libqucs.0.dylib`qucs::circuit::getMatrixS(this=0x0000000100c0df30) + 154 at circuit.cpp:658, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x100d00000)
frame #0: 0x000000010005dd9a libqucs.0.dylib`qucs::circuit::getMatrixS(this=0x0000000100c0df30) + 154 at circuit.cpp:658
655 matrix res (size);
656 for(unsigned int i=0; i < size; ++i)
657 for(unsigned int j=0; i < size; ++j)
-> 658 res(i,j) = MatrixS[i*size + j];
659 return res;
660 }
661
(lldb) bt
* thread #1: tid = 0x45bad, 0x000000010005dd9a libqucs.0.dylib`qucs::circuit::getMatrixS(this=0x0000000100c0df30) + 154 at circuit.cpp:658, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x100d00000)
* frame #0: 0x000000010005dd9a libqucs.0.dylib`qucs::circuit::getMatrixS(this=0x0000000100c0df30) + 154 at circuit.cpp:658
frame #1: 0x00000001001e48f1 libqucs.0.dylib`bjt::calcNoiseSP(this=0x0000000100c0df30, frequency=100000) + 97 at bjt.cpp:129
frame #2: 0x000000010007ab3a libqucs.0.dylib`qucs::spsolver::calc(this=0x0000000100c082e0, freq=100000) + 122 at spsolver.cpp:453
frame #3: 0x000000010007b0e7 libqucs.0.dylib`qucs::spsolver::solve(this=0x0000000100c082e0) + 727 at spsolver.cpp:607
frame #4: 0x000000010006e9fd libqucs.0.dylib`qucs::net::runAnalysis(this=0x0000000100c08180, err=0x00007fff5fbff008) + 493 at net.cpp:267
frame #5: 0x0000000100002b09 qucsator`main(argc=3, argv=0x00007fff5fbffa00) + 8089 at ucs.cpp:251
frame #6: 0x00007fff86ee95fd libdyld.dylib`start + 1
(lldb)
This is the offending commit: 379559da, see this line change.
By comparison other getters are also broken.
Funny, I totally missed that the inner loop condition is wrong... If loop with indexes give similar performance [1], I would use for loops. just because it is more readable. I fill push a fix in a minute.
[1] http://nadeausoftware.com/articles/2012/05/c_c_tip_how_copy_memory_quickly
Fix merged.
With this simple circuit
qucsator
segfaults (andqucs
does not even realize that, see #132 ); when the noise analysis is disabled simulation works fine.Schematic file is available at https://gist.github.com/in3otd/b90e9f9b658d4e1db290/download
Edit: works in 0.0.17 but not in 0.0.18 or later