|
From: sgromoll <sgr...@gr...> - 2006-06-20 14:17:01
|
Hi,
I am trying to use valgrind to debug a segfault. The program seems to be
crashing on a statement that declares an stl map:
map<int, float> type_to_a1;
cout << "OK" << endl;
map<int, float> type_to_a2; // CRASHES HERE
Valgrind reports no errors before this statement. When it segfaults,
valgrind reports:
==21379== Invalid read of size 4
==21379== at 0x1BE22632: std::__default_alloc_template<true,
0>::allocate(unsigned) (in /usr/lib/libstdc++.so.5.0.7)
==21379== by 0x1BB93FFE:
std::__simple_alloc<std::_Rb_tree_node<std::pair<int const, float> >,
std::__default_alloc_template<true, 0> >::allocate(unsigned)
(stl_alloc.h:232)
==21379== by 0x1BB93FC1: std::_Rb_tree_alloc_base<std::pair<int const,
float>, std::allocator<std::pair<int const, float> >, true>::_M_get_node()
(stl_tree.h:564)
==21379== by 0x1BB93F8C: std::_Rb_tree_base<std::pair<int const, float>,
std::allocator<std::pair<int const, float> >
>::_Rb_tree_base(std::allocator<std::pair<int const, float> > const&)
(stl_tree.h:579)
==21379== Address 0x4 is not stack'd, malloc'd or (recently) free'd
==21379==
==21379== Process terminating with default action of signal 11 (SIGSEGV)
==21379== Access not within mapped region at address 0x4
==21379== at 0x1BE22632: std::__default_alloc_template<true,
0>::allocate(unsigned) (in /usr/lib/libstdc++.so.5.0.7)
==21379== by 0x1BB93FFE:
std::__simple_alloc<std::_Rb_tree_node<std::pair<int const, float> >,
std::__default_alloc_template<true, 0> >::allocate(unsigned)
(stl_alloc.h:232)
==21379== by 0x1BB93FC1: std::_Rb_tree_alloc_base<std::pair<int const,
float>, std::allocator<std::pair<int const, float> >, true>::_M_get_node()
(stl_tree.h:564)
==21379== by 0x1BB93F8C: std::_Rb_tree_base<std::pair<int const, float>,
std::allocator<std::pair<int const, float> >
>::_Rb_tree_base(std::allocator<std::pair<int const, float> > const&)
(stl_tree.h:579)
==21379==
==21379== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 36 from 2)
Is valgrind reporting an error in STL? it seems more likely that i am
corrupting memory but valgrind does not report any other errors before this.
I noticed in the FAQ that memcheck can't do bounds checking on static
arrays- is this a possible explanation?
thanks,
-stefan
--
View this message in context: http://www.nabble.com/memcheck-error-in-libstdc%2B%2B.so.5.0.7-t1817850.html#a4955850
Sent from the Valgrind - Users forum at Nabble.com.
|