Consider a very simple program: // beginning of file crush_it.cxx #include <iostream> #include <vector> using namespace std; #include <ginac/ginac.h> using namespace GiNaC; int main(int argc,char* argv[]) { vector<symbol> sv(3); sv[0] = symbol("x"); sv[1] = symbol("y"); sv[2] = symbol("z"); cout << "All is OK " << "\n"; cout << sv[0] << " "; cout << sv[1] << " "; cout << "All is OK again" << "\n"; return 0; // segfault here! } // end of file crush_it.cxx And here is gdb session: Breakpoint 3, main (argc=1, argv=0xbffffb24) at crush_it.cxx:21 21 return 0; (gdb) bt #0 main (argc=1, argv=0xbffffb24) at crush_it.cxx:21 (gdb) next Program received signal SIGSEGV, Segmentation fault. 0x403d27fe in free () from /lib/libc.so.6 (gdb) bt #0 0x403d27fe in free () from /lib/libc.so.6 #1 0x403d26d3 in free () from /lib/libc.so.6 #2 0x4032d6b4 in __builtin_delete () from /usr/lib/libstdc++-libc6.2-2.so.3 #3 0x401e6c8d in GiNaC::symbol::destroy () from /usr/lib/libginac-1.0.so.0 #4 0x401ea110 in GiNaC::symbol::~symbol () from /usr/lib/libginac-1.0.so.0 #5 0x0804c0d7 in void destroy<GiNaC::symbol> (__pointer=0x805259c) at /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_construct.h:43 #6 0x0804bfa1 in void __destroy_aux<GiNaC::symbol *> (__first=0x8052578, __last=0x80525e4) at /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_construct.h:61 #7 0x0804bbfc in void __destroy<GiNaC::symbol *, GiNaC::symbol> (__first=0x8052578, __last=0x80525e4) at /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_construct.h:73 #8 0x0804b85c in void destroy<GiNaC::symbol *> (__first=0x8052578, __last=0x80525e4) at /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_construct.h:78 #9 0x0804b881 in vector<GiNaC::symbol, allocator<GiNaC::symbol> >::~vector (this=0xbffffab0, __in_chrg=2) at /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/stl_vector.h:266 #10 0x0804a4dd in main (argc=1, argv=0xbffffb24) at crush_it.cxx:21 I use Debian "sid", GiNaC 1.0.10 (installed from debs), g++ 2.95.4
Hi! On Sun, Sep 15, 2002 at 03:49:00PM +0400, Sheplyakov Alexey wrote:
vector<symbol> sv(3);
It's better to use "vector<ex>" here. Bye, Christian -- / Coding on PowerPC and proud of it \/ http://www.uni-mainz.de/~bauec002/
participants (2)
-
Christian Bauer
-
Sheplyakov Alexey