J
janzon
Hi
I have a really weird bug. An object in my program contains a
std::stack<T>. When push is called, the program crashes. To eliminate
that the error has to do with what is pushed, I create a new local
stack that has nothing to do with any other code. Then I push a 5 and
the program crashes. In detail, i added
stack<double> anewstack; // Code that has nothing to do with the
rest of the program
anewstack.push(5);
instead of the call to the other stack (that call I out-commented). If
I remove "irrelevant" code the bug disappears so I can't provide a
small complete program that generates the bug.
Does anyone have any clue how this kind of bug can appear, and be
resolved? Below some output from the debugger. I'm working in Sun
Solaris on a Sun X-Ray computer.
t@1 (l@1) stopped in Solver::feed at line 249 in file "solver.cc"
249 stack<double> anewstack;
(dbx) next
t@1 (l@1) stopped in Solver::feed at line 250 in file "solver.cc"
250 anewstack.push(4);
(dbx) next
t@1 (l@1) signal SEGV (no mapping at the fault address) in
_malloc_unlocked at 0xfed47090
0xfed47090: _malloc_unlocked+0x023c: ld [%o0 + 8], %o1
Current function is std::allocator<double>::allocate
391 void * tmp = _RWSTD_STATIC_CAST(void*,perator
new(_RWSTD_STATIC_CAST(size_t,(n)))));
(dbx)
I have a really weird bug. An object in my program contains a
std::stack<T>. When push is called, the program crashes. To eliminate
that the error has to do with what is pushed, I create a new local
stack that has nothing to do with any other code. Then I push a 5 and
the program crashes. In detail, i added
stack<double> anewstack; // Code that has nothing to do with the
rest of the program
anewstack.push(5);
instead of the call to the other stack (that call I out-commented). If
I remove "irrelevant" code the bug disappears so I can't provide a
small complete program that generates the bug.
Does anyone have any clue how this kind of bug can appear, and be
resolved? Below some output from the debugger. I'm working in Sun
Solaris on a Sun X-Ray computer.
t@1 (l@1) stopped in Solver::feed at line 249 in file "solver.cc"
249 stack<double> anewstack;
(dbx) next
t@1 (l@1) stopped in Solver::feed at line 250 in file "solver.cc"
250 anewstack.push(4);
(dbx) next
t@1 (l@1) signal SEGV (no mapping at the fault address) in
_malloc_unlocked at 0xfed47090
0xfed47090: _malloc_unlocked+0x023c: ld [%o0 + 8], %o1
Current function is std::allocator<double>::allocate
391 void * tmp = _RWSTD_STATIC_CAST(void*,perator
new(_RWSTD_STATIC_CAST(size_t,(n)))));
(dbx)