This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [libstdc++ patch] Fix basic_string::_S_construct null pointercheck
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: Doug Gregor <dgregor at apple dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, Nathan Myers <ncm-nospam at cantrip dot org>
- Date: Mon, 14 Jul 2003 20:54:59 +0200
- Subject: Re: [libstdc++ patch] Fix basic_string::_S_construct null pointercheck
- References: <BD01451F-B62B-11D7-8746-00039354D67A@apple.com>
Doug Gregor wrote:
basic_string::_S_construct attempts to do a null-pointer check by
comparing the "__beg" iterator to a default-constructed iterator of
the same type. This both triggers an error in debug mode ("attempt to
compare against a singular iterator") and could cause incorrect
behavior in release mode in the following unlikely circumstance:
1) [begin, end) is an empty iterator range, and
2) end is equal to a default-constructed iterator, and
3) the user passes in an allocator that is not equivalent to a
default-constructed allocator
Nathan, you already investigated the issue: do you consider this the
most correct fix?
Thanks,
Paolo.