libstdc++: Problems with gslices (patch included)

Gabriel Dos Reis
Sat Feb 10 22:33:00 GMT 2001

Peter Schmid <> writes:

| When running the following program tgs compiled by g++-20010125 on
| i686-pc-linux-gnu 


| incorrect output is obtained.
| ./tgs
| abcdefghijklmnop
| abcAeCBEDjFlmnop
| abcdefghijklmnop
| dgfihkjmlon
| cfilo
| Closer examination shows that the arguments of len and str in the 
| gslice implementation seem to be reversed.

Your analysis is correct,
  from gslice.h:

    gslice::gslice(size_t __o, const valarray<size_t>& __l,
                   const valarray<size_t>& __s)
            : _M_index(new gslice::_Indexer(__o, __l, __s)) {}


    gslice::_Indexer::_Indexer(size_t __o, const valarray<size_t>& __s,
                               const valarray<size_t>& __l)

which clearly shows that the arguments were reversed in the last

Thanks for your feedback.  Fixed with fortcoming patch.

-- Gaby
CodeSourcery, LLC             

More information about the Libstdc++ mailing list