help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _GLIBCXX_DEBUG and std::list


From: Paul Pluzhnikov
Subject: Re: _GLIBCXX_DEBUG and std::list
Date: Fri, 01 Jun 2007 07:50:13 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

mathieu <mathieu.malaterre@gmail.com> writes:

>   I was recently suggested to use -D_GLIBCXX_DEBUG to compile my
> project to detect any misuse of the STL (Thanks Paul P.). That's what
> I did and now running the code through valgrind I am getting:

Hmm, I didn't expect you to do both -D_GLIBCXX_DEBUG and VG
(though it's still a valid thing to do).

I expect you'll get similar VG errors even without -D_GLIBCXX_DEBUG

> ==20939== Invalid write of size 4
> ==20939==    at 0x40D557C: 
> __gnu_debug::_Safe_sequence_base::_Safe_sequence_base() (safe_base.h:179)
> ==20939==    by 0x40D5724: 
> __gnu_debug::_Safe_sequence<std::__debug::list<gdcm::Element, 
> std::allocator<gdcm::Element> > >::_Safe_sequence() (safe_sequence.h:103)
> ==20939==    by 0x40D84B5: 
> std::__debug::list<gdcm::Element,std::allocator<gdcm::Element> 
> >::list(std::allocator<gdcm::Element> const&) (list:103)
> ==20939==    by 0x411C563: gdcm::Document::Document() (gdcmDocument.cxx:58)

This isn't complete VG message. There should be some stuff following
the above lines, which tells you what address is being written,
and what VG knows about that address.

Unfortunately that info (which you presumably trimmed) is the key
to understanding what the error means.

> Is there a document somewhere describing what this means and/or how
> to fix my code.

You may try posting your entire error message to the valgrind-users
mailing list at https://lists.sourceforge.net/lists/listinfo/valgrind-users

Before you do that, you should check that this is not a "glitch"
in your system setup: write a trivial program that uses std::list
correctly, compile it the same way and run it through VG; it should
show no errors. Now "inject" some bugs into it, and see what
comes out.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]