public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length
@ 2012-08-28 13:42 redi at gcc dot gnu.org
  2012-08-28 18:03 ` [Bug libstdc++/54392] " hjl.tools at gmail dot com
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2012-08-28 13:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

             Bug #: 54392
           Summary: [4.6/4.7/4.8 Regression] std::string::append() fails
                    to update length
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org


#include <string>
#include <cassert>

int main()
{
    std::string s1, s2;
    s1.assign(s2.c_str(), 1);
    assert( s1.size() == 1 );
}

This test passes with G++ 4.4, but in 4.5 and later string::assign(const char*,
size_type) doesn't mutate the string but tries to work in-place on the empty
rep, then tries (and fails) to set the length of the empty rep to 1.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::append() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
@ 2012-08-28 18:03 ` hjl.tools at gmail dot com
  2012-08-28 18:10 ` redi at gcc dot gnu.org
                   ` (26 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: hjl.tools at gmail dot com @ 2012-08-28 18:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-08-28
                 CC|                            |paolo.carlini at oracle dot
                   |                            |com
     Ever Confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2012-08-28 18:03:34 UTC ---
It is caused by revision 148850:

http://gcc.gnu.org/ml/gcc-cvs/2009-06/msg00833.html


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::append() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
  2012-08-28 18:03 ` [Bug libstdc++/54392] " hjl.tools at gmail dot com
@ 2012-08-28 18:10 ` redi at gcc dot gnu.org
  2012-08-29  7:36 ` [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() " redi at gcc dot gnu.org
                   ` (25 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2012-08-28 18:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-28 18:10:13 UTC ---
(In reply to comment #1)
> It is caused by revision 148850:
> 
> http://gcc.gnu.org/ml/gcc-cvs/2009-06/msg00833.html

That patch fixed a race condition, and it *is* correct to prevent writes to the
empty shared rep. If we reverted that patch we'd reintroduce the race, and
still erroneously write to the empty rep.

The underlying bug is in string::append() where it tries to write to it in the
first place. I think as well as checking _M_disjunct(__s) and _M_is_shared() we
should check whether we have the empty rep.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
  2012-08-28 18:03 ` [Bug libstdc++/54392] " hjl.tools at gmail dot com
  2012-08-28 18:10 ` redi at gcc dot gnu.org
@ 2012-08-29  7:36 ` redi at gcc dot gnu.org
  2012-08-29 10:50 ` michael.haubenwallner at salomon dot at
                   ` (24 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2012-08-29  7:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.6/4.7/4.8 Regression]    |[4.6/4.7/4.8 Regression]
                   |std::string::append() fails |std::string::assign() fails
                   |to update length            |to update length

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-29 07:35:36 UTC ---
For some reason my fingers keep typing append when I mean assign.

s/append/assign/g


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-08-29  7:36 ` [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() " redi at gcc dot gnu.org
@ 2012-08-29 10:50 ` michael.haubenwallner at salomon dot at
  2012-08-29 14:16 ` paolo.carlini at oracle dot com
                   ` (23 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: michael.haubenwallner at salomon dot at @ 2012-08-29 10:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #4 from Michael Haubenwallner <michael.haubenwallner at salomon dot at> 2012-08-29 10:50:22 UTC ---
(In reply to comment #0)

Extending the testcase shows even more bad behavior in 4.4.3 and earlier:

#include <string>
#include <cassert>

int main()
{
    std::string s1, s2;
    s1.assign(s2.c_str(), 1);
    assert( s1.size() == 1 );

    std::string s3;
    assert( s3.size() == 0 ); // up to gcc-4.4.3 fail here
}


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-08-29 10:50 ` michael.haubenwallner at salomon dot at
@ 2012-08-29 14:16 ` paolo.carlini at oracle dot com
  2012-08-29 14:47 ` paolo.carlini at oracle dot com
                   ` (22 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-29 14:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-29 14:15:58 UTC ---
Jon, didn't we somehow discuss this issue already, in a slightly different form
(the issue of course was less evident pre that fix)? Thus, if I remember
correctly what I was thinking at that time, a good general and safe fix would
be tweaking a bit _M_disjunct, making it more careful so to speak, thus
considering the address of the source as overlapping also if it corresponds to
the '\0' at the end of destination. The philosophy in other terms is
"preserving" the whole internal buffer, thus '\0' included. Matter of adding a
+ 1 somewhere, in other terms ;) If my analysis is correct, the fix would work
as a special case for the test here involving empty reps, and I think it's the
safe fix we want for the current std::string implementation at this stage.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-08-29 14:16 ` paolo.carlini at oracle dot com
@ 2012-08-29 14:47 ` paolo.carlini at oracle dot com
  2012-08-29 15:14 ` paolo.carlini at oracle dot com
                   ` (21 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-29 14:47 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-29 14:47:28 UTC ---
Nope, I checked and _M_disjunct seems already Ok. The issue is actually with
the logic in assign when _M_disjunct is false: it assumes we are simply
overwriting things and no memory allocation needed.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-08-29 14:47 ` paolo.carlini at oracle dot com
@ 2012-08-29 15:14 ` paolo.carlini at oracle dot com
  2012-08-29 15:21 ` michael.haubenwallner at salomon dot at
                   ` (20 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-29 15:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-29 15:13:57 UTC ---
Thus, I guess the right thing to do is sort-of the other way around of what I
was thinking: change _M_disjunct in such a way that when the destination is the
empty rep it always returns true, thus we first allocate memory for the
destination and then copy the '\0' to it and everything is fine (nothing bad
can happen to the source in this special case because the empty rep source
isn't in dynamically allocated memory, thus isn't deallocated, it stays in
memory forever).


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2012-08-29 15:14 ` paolo.carlini at oracle dot com
@ 2012-08-29 15:21 ` michael.haubenwallner at salomon dot at
  2012-08-29 15:29 ` paolo.carlini at oracle dot com
                   ` (19 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: michael.haubenwallner at salomon dot at @ 2012-08-29 15:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #8 from Michael Haubenwallner <michael.haubenwallner at salomon dot at> 2012-08-29 15:20:50 UTC ---
Actually, valgrind does show an "Invalid write of size 1" for this testcase,
unrelated to the default string at all:

{
  std::string s1 = "a";
  s1.assign(s1.c_str(), 2);
}

So I'm proposing this fix here:

--- basic_string.tcc.orig       2012-08-29 17:12:53.349220855 +0200
+++ basic_string.tcc    2012-08-29 17:13:37.021326394 +0200
@@ -262,7 +262,7 @@
     {
       __glibcxx_requires_string_len(__s, __n);
       _M_check_length(this->size(), __n, "basic_string::assign");
-      if (_M_disjunct(__s) || _M_rep()->_M_is_shared())
+      if (_M_disjunct(__s) || _M_rep()->_M_is_shared() || this->size() < __n)
        return _M_replace_safe(size_type(0), this->size(), __s, __n);
       else
        {


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2012-08-29 15:21 ` michael.haubenwallner at salomon dot at
@ 2012-08-29 15:29 ` paolo.carlini at oracle dot com
  2012-08-29 15:33 ` paolo.carlini at oracle dot com
                   ` (18 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-29 15:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-29 15:28:45 UTC ---
Ok, I see. The problem is that when the source is inside the destination, we
may be copying one more char, the final '\0', than the current size and
overflow the allocated memory. We need reallocation in this case too. But we
can't just follow the path of _M_replace_safe, because it deallocates the
source! This case is harder to fix than the empty rep special case.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2012-08-29 15:29 ` paolo.carlini at oracle dot com
@ 2012-08-29 15:33 ` paolo.carlini at oracle dot com
  2012-08-29 16:21 ` paolo.carlini at oracle dot com
                   ` (17 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-29 15:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #10 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-29 15:32:29 UTC ---
Note that the last snippet definitely caused problems even before the recent
changes. Can't be a regression. Given the current status of the implementation
I'm not sure if is worth fixing right now.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2012-08-29 15:33 ` paolo.carlini at oracle dot com
@ 2012-08-29 16:21 ` paolo.carlini at oracle dot com
  2012-08-29 16:53 ` paolo.carlini at oracle dot com
                   ` (16 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-29 16:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-29 16:20:43 UTC ---
I'm sorry, you are right - it's been a while since the last time I looked into
this code - going that way of the conditional is Ok, because the memory
corresponding to the source (which coincide with that of the destination
string) is deallocated only after all the chars are copied. Good. Thus it means
that in general, we want, again to change _M_disjoint not to check that the
destination is the empty rep, but precisely for this more general case, that
is, the source begin is the same as the this->begin() beginning, and the size
is this->size() + 1 and return true. We have to add an overload, because the
current one doesn't take the size of the source. I think this is it.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2012-08-29 16:21 ` paolo.carlini at oracle dot com
@ 2012-08-29 16:53 ` paolo.carlini at oracle dot com
  2012-08-29 23:21 ` paolo.carlini at oracle dot com
                   ` (15 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-29 16:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #12 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-29 16:53:02 UTC ---
Nope, unfortunately I remembered correctly: if we call _M_replace_safe for
these cases the new chars are copied at the very end. At that point, the
destination string is already reallocated but in these cases it's also the
source string and __s doesn't point anymore to it. _M_replace_safe is exactly
for when __s remains a valid address for the source chars from beginning to end
of the whole operation.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2012-08-29 16:53 ` paolo.carlini at oracle dot com
@ 2012-08-29 23:21 ` paolo.carlini at oracle dot com
  2012-08-30  7:33 ` michael.haubenwallner at salomon dot at
                   ` (14 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-29 23:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #13 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-29 23:21:25 UTC ---
In fact, considering this issue a regression seems a bit of an over stretch to
me: the empty rep case used to work essentially be chance, it's just a very
special case (... of a very special case, which nobody bothered to report about
in some 10 years). If you ask me, I would not handle this for std::string and
fix it instead in vstring (where, by the way, a fix is straightforward and
localized to _M_replace, I'll take care of that ASAP)


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2012-08-29 23:21 ` paolo.carlini at oracle dot com
@ 2012-08-30  7:33 ` michael.haubenwallner at salomon dot at
  2012-08-31 16:52 ` paolo.carlini at oracle dot com
                   ` (13 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: michael.haubenwallner at salomon dot at @ 2012-08-30  7:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #14 from Michael Haubenwallner <michael.haubenwallner at salomon dot at> 2012-08-30 07:33:16 UTC ---
Indeed, the old buffer is freed before being copied.

Yep, this isn't a regression. In fact, with 4.4.3 it was the /empty string/
having the size of 1 in the comment#0 testcase, so bug#40518 actually improved
things here.

However, doesn't any operation with (const _CharT*, size_type) as input
parameter potentially have a problem with ( own.c_str(), own.size()+1 ) ?


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2012-08-30  7:33 ` michael.haubenwallner at salomon dot at
@ 2012-08-31 16:52 ` paolo.carlini at oracle dot com
  2012-09-06 14:44 ` rguenth at gcc dot gnu.org
                   ` (12 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-08-31 16:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #15 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-31 16:52:16 UTC ---
Yes it does. However considering that nobody noticed that for 10 years and that
the std::string implementation is near its end of life anyway (as I said, in
the new one the fix is straightforward and I'll take care of it in a few days)
I don't consider this issue very serious, frankly.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2012-08-31 16:52 ` paolo.carlini at oracle dot com
@ 2012-09-06 14:44 ` rguenth at gcc dot gnu.org
  2012-09-07 10:45 ` rguenth at gcc dot gnu.org
                   ` (11 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-06 14:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.4


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2012-09-06 14:44 ` rguenth at gcc dot gnu.org
@ 2012-09-07 10:45 ` rguenth at gcc dot gnu.org
  2013-01-11 15:58 ` jakub at gcc dot gnu.org
                   ` (10 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-07 10:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
           Priority|P3                          |P2


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2012-09-07 10:45 ` rguenth at gcc dot gnu.org
@ 2013-01-11 15:58 ` jakub at gcc dot gnu.org
  2013-01-11 16:01 ` paolo.carlini at oracle dot com
                   ` (9 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-01-11 15:58 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-11 15:57:40 UTC ---
So, what are we going to do with this?  Defer for 4.9, or fix for 4.8?


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  2013-01-11 15:58 ` jakub at gcc dot gnu.org
@ 2013-01-11 16:01 ` paolo.carlini at oracle dot com
  2013-01-11 16:04 ` paolo.carlini at oracle dot com
                   ` (8 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-11 16:01 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #17 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-11 16:01:28 UTC ---
In my opinion, this isn't really fixable in a generic and decently neat way in
the current implementation, that is in std::string. I still mean to fix it in
__versa_string for 4.8 too if you like, when I'm back from my 1-week vacations.
There a fix is pretty simple.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (18 preceding siblings ...)
  2013-01-11 16:01 ` paolo.carlini at oracle dot com
@ 2013-01-11 16:04 ` paolo.carlini at oracle dot com
  2013-01-11 18:59 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-11 16:04 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #18 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-11 16:03:23 UTC ---
PS: for 4.9, I think we essentially agree that we want to roll in anyway
__versa_string, break the ABI, etc. We also exchanged some ideas about that
with Jason, off lists.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (19 preceding siblings ...)
  2013-01-11 16:04 ` paolo.carlini at oracle dot com
@ 2013-01-11 18:59 ` redi at gcc dot gnu.org
  2013-01-31 10:06 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2013-01-11 18:59 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #19 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-11 18:58:53 UTC ---
Agreed. I don't think we'll ever fix this in the current std::string code TBH


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (20 preceding siblings ...)
  2013-01-11 18:59 ` redi at gcc dot gnu.org
@ 2013-01-31 10:06 ` paolo.carlini at oracle dot com
  2013-04-12 15:17 ` [Bug libstdc++/54392] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-01-31 10:06 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #20 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-01-31 10:05:35 UTC ---
In fact, ext/vstring seems *already* Ok. The reason being that before checking
whether we can work in place we check whether a reallocation is needed, thus in
all the cases at issue here _M_replace immediately calls _M_mutate, which does
the right thing. I'll double check anyway. Also, I'll see again-again whether I
can figure out something decently neat for current basic_string.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.7/4.8/4.9 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (21 preceding siblings ...)
  2013-01-31 10:06 ` paolo.carlini at oracle dot com
@ 2013-04-12 15:17 ` jakub at gcc dot gnu.org
  2014-03-04 11:45 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-12 15:17 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.6.4                       |4.7.4

--- Comment #21 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-04-12 15:16:49 UTC ---
GCC 4.6.4 has been released and the branch has been closed.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.7/4.8/4.9 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (22 preceding siblings ...)
  2013-04-12 15:17 ` [Bug libstdc++/54392] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
@ 2014-03-04 11:45 ` jakub at gcc dot gnu.org
  2014-03-04 12:02 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-03-04 11:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #22 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So 5.0 material, given that we are not going to change std::string in 4.9?


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.7/4.8/4.9 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (23 preceding siblings ...)
  2014-03-04 11:45 ` jakub at gcc dot gnu.org
@ 2014-03-04 12:02 ` redi at gcc dot gnu.org
  2014-06-12 13:48 ` [Bug libstdc++/54392] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-04 12:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

--- Comment #23 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, definitely. It should get fixed automatically by switching to the new
std::string impl.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.7/4.8/4.9/4.10 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (24 preceding siblings ...)
  2014-03-04 12:02 ` redi at gcc dot gnu.org
@ 2014-06-12 13:48 ` rguenth at gcc dot gnu.org
  2014-09-19 13:26 ` [Bug libstdc++/54392] [4.8/4.9/5 " redi at gcc dot gnu.org
  2014-12-22 13:51 ` redi at gcc dot gnu.org
  27 siblings, 0 replies; 29+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-12 13:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.7.4                       |4.8.4

--- Comment #24 from Richard Biener <rguenth at gcc dot gnu.org> ---
The 4.7 branch is being closed, moving target milestone to 4.8.4.


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.8/4.9/5 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (25 preceding siblings ...)
  2014-06-12 13:48 ` [Bug libstdc++/54392] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
@ 2014-09-19 13:26 ` redi at gcc dot gnu.org
  2014-12-22 13:51 ` redi at gcc dot gnu.org
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2014-09-19 13:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |24882
   Target Milestone|4.8.4                       |5.0


^ permalink raw reply	[flat|nested] 29+ messages in thread

* [Bug libstdc++/54392] [4.8/4.9/5 Regression] std::string::assign() fails to update length
  2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
                   ` (26 preceding siblings ...)
  2014-09-19 13:26 ` [Bug libstdc++/54392] [4.8/4.9/5 " redi at gcc dot gnu.org
@ 2014-12-22 13:51 ` redi at gcc dot gnu.org
  27 siblings, 0 replies; 29+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-22 13:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54392

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #25 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for GCC 5 (when using the new string ABI)


^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2014-12-22 13:51 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-28 13:42 [Bug libstdc++/54392] New: [4.6/4.7/4.8 Regression] std::string::append() fails to update length redi at gcc dot gnu.org
2012-08-28 18:03 ` [Bug libstdc++/54392] " hjl.tools at gmail dot com
2012-08-28 18:10 ` redi at gcc dot gnu.org
2012-08-29  7:36 ` [Bug libstdc++/54392] [4.6/4.7/4.8 Regression] std::string::assign() " redi at gcc dot gnu.org
2012-08-29 10:50 ` michael.haubenwallner at salomon dot at
2012-08-29 14:16 ` paolo.carlini at oracle dot com
2012-08-29 14:47 ` paolo.carlini at oracle dot com
2012-08-29 15:14 ` paolo.carlini at oracle dot com
2012-08-29 15:21 ` michael.haubenwallner at salomon dot at
2012-08-29 15:29 ` paolo.carlini at oracle dot com
2012-08-29 15:33 ` paolo.carlini at oracle dot com
2012-08-29 16:21 ` paolo.carlini at oracle dot com
2012-08-29 16:53 ` paolo.carlini at oracle dot com
2012-08-29 23:21 ` paolo.carlini at oracle dot com
2012-08-30  7:33 ` michael.haubenwallner at salomon dot at
2012-08-31 16:52 ` paolo.carlini at oracle dot com
2012-09-06 14:44 ` rguenth at gcc dot gnu.org
2012-09-07 10:45 ` rguenth at gcc dot gnu.org
2013-01-11 15:58 ` jakub at gcc dot gnu.org
2013-01-11 16:01 ` paolo.carlini at oracle dot com
2013-01-11 16:04 ` paolo.carlini at oracle dot com
2013-01-11 18:59 ` redi at gcc dot gnu.org
2013-01-31 10:06 ` paolo.carlini at oracle dot com
2013-04-12 15:17 ` [Bug libstdc++/54392] [4.7/4.8/4.9 " jakub at gcc dot gnu.org
2014-03-04 11:45 ` jakub at gcc dot gnu.org
2014-03-04 12:02 ` redi at gcc dot gnu.org
2014-06-12 13:48 ` [Bug libstdc++/54392] [4.7/4.8/4.9/4.10 " rguenth at gcc dot gnu.org
2014-09-19 13:26 ` [Bug libstdc++/54392] [4.8/4.9/5 " redi at gcc dot gnu.org
2014-12-22 13:51 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).