This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: string find
- To: "Benjamin Kosnik" <bkoz at redhat dot com>
- Subject: Re: string find
- From: "Anthony Williams" <anthony_w dot geo at yahoo dot com>
- Date: Mon, 26 Jun 2000 09:35:23 +0100
- Cc: <libstdc++ at sourceware dot cygnus dot com>
- References: <Pine.SOL.3.91.1000623091933.16709A-100000@cse.cygnus.com>
- Reply-To: "Anthony Williams" <anthony at anthonyw dot cjb dot net>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
From: Benjamin Kosnik <bkoz@redhat.com>
Sent: 23 June 2000 17:21
> > Sorry, 21_strings ctor_copy_dtor still fails on sparc-solaris-2.7 with
CVS
> > gcc,
> > CVS libstdc++ and binutils 2.9.1
>
> Hmm. Anyway you can try to track this down? this has been plaguing the
> solaris builds for a long time.
>
The core dump is due to a seg fault when trying to copy a string of
max_size()-1 from a string literal that isn't that long. The comment says
"This
shouldn't crash, but the results are undefined" or something, which I
disagree
with. If you read 1Gb past the end of a string literal, most likely you are
in
unallocated memory, thus causing a seg fault. I think, therefore, that it is
a
test suite problem. (Phew!) Here is a patch.
Index: testsuite/21_strings/ctor_copy_dtor.cc
===================================================================
RCS file:
/cvs/gcc/egcs/libstdc++-v3/testsuite/21_strings/ctor_copy_dtor.cc,v
retrieving revision 1.1
diff -c -p -r1.1 ctor_copy_dtor.cc
*** ctor_copy_dtor.cc 2000/04/21 20:33:33 1.1
- --- ctor_copy_dtor.cc 2000/06/26 08:35:09
*************** int test01(void)
*** 90,98 ****
test &= false;
}
try {
! std::string str03(str_lit01, csz01 - 1);
! test &= str03.size() != 0;
test &= str03.size() <= str03.capacity();
}
// NB: bad_alloc is regrettable but entirely kosher for
- --- 90,99 ----
test &= false;
}
+ // build a maxsize-1 lengthed string consisting of all A's
try {
! std::string str03( csz01 - 1,'A');
! test &= str03.size() == csz01 -1;
test &= str03.size() <= str03.capacity();
}
// NB: bad_alloc is regrettable but entirely kosher for
Anthony
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.1 for non-commercial use <http://www.pgp.com>
Comment: PGP Key at: http://i3.yimg.com/3/c7e5ee24/g/68fc2307.asc
iQA/AwUBOVcVypvw+P4cG5rVEQIWMgCgtbqcn7R22uHsHsXhItZVn7qkW5wAoK3G
+Bx1NELqX+nvinSq5WfoyVcA
=5Ebw
-----END PGP SIGNATURE-----
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com