stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Liviu Nicoara <nico...@roguewave.com>
Subject Re: basic_string::insert (iterator p, InputIterator first, InputIterator last) on Linux, gcc-4.0.2
Date Mon, 03 Apr 2006 16:15:44 GMT
Anton,

I am going to try it on one of our SUSE 9 boxes and I will let you know
how it goes for me.

Thanks,
Liviu

Anton Pevtsov wrote:
> Hi Liviu,
> 
> Your test either doesn't work on my environment. I have gcc built by
> myself on SuSe Linux 9.1.  
> 
> Thanks,
> Anton Pevtsov
> 
> 
> -----Original Message-----
> From: Liviu Nicoara [mailto:nicoara@roguewave.com] 
> Sent: Monday, April 03, 2006 19:53
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: basic_string::insert (iterator p, InputIterator first,
> InputIterator last) on Linux, gcc-4.0.2
> 
> 
> Hi Anton,
> 
> I used a slightly modified test case:
> 
> $ uname -a
> Linux skynet 2.6.14.5 #3 SMP PREEMPT Mon Jan 9 13:59:21 MST 2006 i686
> unknown unknown GNU/Linux
> 
> $ gcc --version
> gcc (GCC) 4.0.2
> Copyright (C) 2005 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is
> NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
> 
> $ cat t.cpp
> 
> #include <iostream>
> #include <string>
> 
> static const char* test = "bcabcdef";
> 
> int main (void)
> {
>     std::string s ("abcdef");
>     s.insert (s.begin (), s.begin () + 1, s.begin () + 3);
> 
>     std::cout << "Expected " << test << " and got " << s <<
'\n';
> 
>     return 0;
> }
> 
> $ make t
> gcc -c -I/build/nicoara/stdcxx/include/ansi -D_RWSTDDEBUG
> -D_RWSTD_USE_CONFIG -I/build/nicoara/stdcxx/build/include
> -I/build/nicoara/stdcxx/include -I/build/nicoara/stdcxx/examples/include
>  -pedantic -nostdinc++ -g  -W -Wall -Wcast-qual -Winline -Wshadow
> -Wwrite-strings -Wno-long-long -Wcast-align
> /build/nicoara/stdcxx/examples/manual/t.cpp
> gcc t.o -o t  -L/build/nicoara/stdcxx/build/lib -lstd11s  -lsupc++ -lm
> 
> and got:
> 
> $ ./t
> Expected bcabcdef and got bcabcdef
> 
> Gcc was built by myself on a Slackware 10.1 box from GNU sources (not RH
> or anything).
> 
> Please let me know if I am missing anything.
> 
> - Liviu
> 
> Liviu Nicoara wrote:
>> Hi Anton,
>>
>> What kind of a build was this? Is the testing infrastructure needed to
> 
>> exhibit the problem or you just used it for convenience in printing 
>> the results?
>>
>> - Liviu
>>
>> Anton Pevtsov wrote:
>>> The basic_string::insert (iterator p, InputIterator first, 
>>> InputIterator
>>> last) doesn't work correctly on Linux for string str when
>>> first = str.begin() + 1, last = str.begin() + 3.
>>>
>>> This code illustrates the problem:
>>>
>>> #include <rw_printf.h>  
>>> #include <rw_char.h>    
>>>
>>> #include <string>
>>> #include <cstddef>
>>>
>>> int main (void)
>>> {
>>>     typedef std::basic_string <char, std::char_traits<char>, 
>>>          std::allocator<char> > TestString;
>>>
>>>     char test[] = "abcdef";
>>>     char exp_test[] = "bcabcdef";
>>>
>>>     TestString s (test, 6);
>>>     s.insert (s.begin (), s.begin () + 1, s.begin () + 3);
>>>
>>>     rw_printf ("this (%{#*s})->insert (*this.begin (), "
>>>                "*this.begin () + 1, *this.begin () + 3) "
>>>                " == %{#*s}, got %{#*s}\n", 
>>>                6, test, 8, exp_test, int (s.size ()), s.c_str ());
>>>
>>>     return 0;
>>> }
>>>
>>>
>>> The output is
>>> this ("abcdef")->insert (*this.begin (), *this.begin () + 1,
> *this.begin
>>> () + 3)  == "bcabcdef", got "baabcdef"
>>>
>>> On Windows the output is:
>>> this ("abcdef")->insert (*this.begin (), *this.begin () + 1, 
>>> *this.begin
>>> () + 3)  == "bcabcdef", got "bcabcdef"
>>>
>>> Martin, could you look into this when you have a chance, please?
>>>
>>> If you reproduce the problem I'll open the jira issue and try to 
>>> investigate the cause.
>>>
>>>
>>> Thanks,
>>> Anton Pevtsov
>>>
> 


Mime
View raw message