[Bug 769601] Re: libstdc++, debug mode: resizing a vector doesn't update capacity

Bug Watch Updater 769601 at bugs.launchpad.net
Wed Aug 22 07:11:52 UTC 2012


Launchpad has imported 13 comments from the remote bug at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44190.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2010-05-18T21:43:06+00:00 Gcc-bugzilla wrote:

The assertion in the following testcase should /not/ fail, but does:

  #define _GLIBCXX_DEBUG
  #define _GLIBCXX_DEBUG_PEDANTIC

  #include <vector>
  #include <cassert>

  int main()
  {
    std::vector<int> v;
    v.resize(10);
    assert(v.size() <= v.capacity());
  }

Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/0

------------------------------------------------------------------------
On 2010-05-18T21:45:29+00:00 Gcc-bugzilla wrote:

Created attachment 20695
Trivial patch that fixes the problem.

The problem was just a missing call to _M_update_guaranteed_capacity().

Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/1

------------------------------------------------------------------------
On 2010-05-18T23:36:47+00:00 Paolo-carlini wrote:

I'm going to apply the patch: could you please provide name and family
name for the ChangeLog entry? Thanks!

Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/2

------------------------------------------------------------------------
On 2010-05-18T23:38:55+00:00 Gcc-bugzilla wrote:

(In reply to comment #2)
> I'm going to apply the patch

Great, thanks! :)

> could you please provide name and family name for
> the ChangeLog entry?

It's "Eelis van der Weegen"


Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/3

------------------------------------------------------------------------
On 2010-05-18T23:59:16+00:00 Paolo-k wrote:

Subject: Bug 44190

Author: paolo
Date: Tue May 18 23:58:50 2010
New Revision: 159549

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159549
Log:
2010-05-18  Eelis van der Weegen  <gcc-bugzilla at contacts.eelis.net>

	PR libstdc++/44190
	* include/debug/vector (vector<>::resize): Call
	_M_update_guaranteed_capacity.
	* testsuite/23_containers/vector/capacity/44190.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/23_containers/vector/capacity/44190.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/debug/vector


Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/4

------------------------------------------------------------------------
On 2010-05-19T00:00:23+00:00 Paolo-carlini wrote:

Fixed.

Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/5

------------------------------------------------------------------------
On 2010-05-19T11:43:30+00:00 Mikpe wrote:

This bug also affects 4.5 and 4.4, but not 4.3, making it a regression
from 4.3. The fix for 4.6 backports cleanly to 4.5 and with minor fuzz
to 4.4, and has been verified to fix the problem on those branches too
with no new testsuite regressions (bootstrapped + regtested on
i686-linux).

Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/6

------------------------------------------------------------------------
On 2010-05-19T11:50:19+00:00 Paolo-carlini wrote:

How it can possibly not affect 4.3? The code is exactly the same.

Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/7

------------------------------------------------------------------------
On 2010-05-19T11:57:32+00:00 Mikpe wrote:

I just compiled the original test case with 4.5, 4.4, and 4.3, and the
assert didn't trigger when compiled with 4.3. I didn't investigate any
further.

Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/8

------------------------------------------------------------------------
On 2010-05-19T12:01:40+00:00 Paolo-carlini wrote:

Given the identical resize code, missing a real analysis of why the
patch is needed in mainline and isn't in 4.3, I don't feel comfortable
committing the patch to the older branches, since nobody else complained
so far and in general the pedantic mode is much less used.

Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/9

------------------------------------------------------------------------
On 2010-05-19T12:06:22+00:00 Paolo-carlini wrote:

Ok, now I see, vector::capacity itself has been changed between 4.3 and
4.4. Let's apply the patch to 4.5 too.

Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/10

------------------------------------------------------------------------
On 2010-05-19T12:09:39+00:00 Paolo-k wrote:

Subject: Bug 44190

Author: paolo
Date: Wed May 19 12:08:53 2010
New Revision: 159560

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159560
Log:
2010-05-19  Eelis van der Weegen  <gcc-bugzilla at contacts.eelis.net>

	PR libstdc++/44190
	* include/debug/vector (vector<>::resize): Call
	_M_update_guaranteed_capacity.
	* testsuite/23_containers/vector/capacity/44190.cc: New.

Added:
    branches/gcc-4_5-branch/libstdc++-v3/testsuite/23_containers/vector/capacity/44190.cc
Modified:
    branches/gcc-4_5-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_5-branch/libstdc++-v3/include/debug/vector


Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/11

------------------------------------------------------------------------
On 2010-05-19T12:29:03+00:00 Mikpe wrote:

(In reply to comment #10)
> Let's apply the patch to 4.5 too.

Thanks!

Reply at: https://bugs.launchpad.net/gcc/+bug/769601/comments/12


** Changed in: gcc
       Status: Unknown => Fix Released

** Changed in: gcc
   Importance: Unknown => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-4.4 in Ubuntu.
https://bugs.launchpad.net/bugs/769601

Title:
  libstdc++, debug mode: resizing a vector doesn't update capacity

Status in The GNU Compiler Collection:
  Fix Released
Status in “gcc-4.4” package in Ubuntu:
  Triaged

Bug description:
  Binary package hint: gcc-4.4

  Bug details / code to reproduce / fix can be found in the upstream bug report:
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44190

  Even though this upstream bug report was filed against gcc-4.5, it's
  also present / reproducible with libstdc++6-4.4-dev, version
  4.4.3-4ubuntu5 on Ubuntu 10.04.

To manage notifications about this bug go to:
https://bugs.launchpad.net/gcc/+bug/769601/+subscriptions




More information about the foundations-bugs mailing list