Re: [ROOT] Problem with STL vectors

From: Alberto Garcia Raboso (Alberto.Garcia.Raboso@cern.ch)
Date: Tue Feb 11 2003 - 17:29:59 MET


Hi Matthew,

Some time ago I had problems with STL vectors in ROOT, as you now have. My 
programs worked fine under gcc 2.96, but not with gcc 3.2. After asking 
some people, I realized that my problem was (and perhaps yours is) that I 
was using STL iterators as pointers. For example, in a ROOT method that 
demands a Double_t* I was using vector<Double_t>::iterator.

In principle, vector<Double_t>::iterator and Double_t* are realizations of 
the concept of random iterator, so I thought I could use this. The reason 
it worked under gcc 2.96 is that, in this gcc version, the internal 
implementation of random iterators uses pointers, whereas in gcc 3.2 it 
uses abstract classes.

Have a look on your code and be sure not to use iterators where you need 
pointers. Hope it helps.

Cheers,

Alberto

On Tue, 11 Feb 2003, Matthew Wood wrote:

> Hi.  I know that I'm supposed to provide an example script that
> demonstrates the error I'm having, but as I am having trouble repeating
> the error myself in any sort of predictable way I thought I would just ask
> generally if anyone had seen this before.  The problem seems to arise when
> I try to mix the STL <vector> library with ROOT.  I keep getting the
> following mysterious message:
> 
>  *** Break *** segmentation violation
>  Generating stack trace...
> /usr/bin/c++filt: unknown demangling style `gnu-new-abi'
> 
> When I switch back to using c-style arrays, the problem seems to go away.
> What's even more mysterious is that most of the time vectors seem to work
> fine but occasionally I will get the above error for no apparent 
> reason.  Switching around the order in which i declare arrays and vectors
> also seems to help sometimes.
> 	Are there known incompatibilities between ROOT and STL?  Does
> anyone know what this message means?  I'm currently running root 3.04/02
> for redhat linux 7.3 and gcc 3.2.
> 
> Matthew Wood
> 
> 

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Alberto Garcia Raboso
Universidad Autónoma de Madrid (Spain)
E-Mail: Alberto.Garcia.Raboso@cern.ch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Well, farewell, my hobbits! You should come safe to your own
homes now, and I shall not be kept awake for fear of your
peril. We will send word when we may, and some of us may yet
meet at times; but I fear that we shall not all be gathered
together ever again.

                      The return of the King. J.R.R. Tolkien
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:09 MET