This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/360: string erase aborts when string length over certain (very small) limit.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: libstdc++/360: string erase aborts when string length over certain (very small) limit.
- From: mvirtan at yahoo dot com
- Date: 29 Jun 2000 13:16:29 -0000
- Reply-To: mvirtan at yahoo dot com
- Resent-Cc: gcc-prs at gcc dot gnu dot org
- Resent-Reply-To: gcc-gnats@gcc.gnu.org, mvirtan@yahoo.com
>Number: 360
>Category: libstdc++
>Synopsis: string erase aborts when string length over certain (very small) limit.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jun 29 06:26:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: g++
>Release: gcc 2.95.2
>Organization:
>Environment:
RedHat Linux 6.2
>Description:
this function works with input:
string s("1234567890123456789 ");
but not with this:
string s("12345678901234567890 ");
void remove_trailing_spaces(string& s)
{
string::iterator p = s.begin();
while(p != s.end())
{
if (isspace(*p) || (*p == '"'))
s.erase(p);
else
p++;
}
}
>How-To-Repeat:
Just compile and run. Please, can you mail me at mvirtan@yahoo.com if you cannot repeat this.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="erase_problem.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="erase_problem.cc"
LyoKICogICAgdGhpcyBjcmFzaGVkCiAqLwoKI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8
c3RyaW5nPgoKCmludCBtYWluKHZvaWQpCnsJCglzdHJpbmcgcygiMTIzNDU2Nzg5MDEyMzQ1Njc4
OTAgICAgICAgICAgICAgIik7CgkKCXN0cmluZzo6aXRlcmF0b3IgcCA9IHMuYmVnaW4oKTsKCXdo
aWxlKHAgIT0gcy5lbmQoKSkKCXsKCQlpZiAoaXNzcGFjZSgqcCkgfHwgKCpwID09ICciJykpCgkJ
CXMuZXJhc2UocCk7CgkJcCsrOwoJfQoJY291dCA8PCBzIDw8IGVuZGw7CgkKCXJldHVybiAwOwp9
CgkK