public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/40779]  New: basic_string::_M_disjunct corner case
@ 2009-07-16 21:22 jkt at mailsnare dot net
  2009-07-16 21:23 ` [Bug libstdc++/40779] " jkt at mailsnare dot net
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jkt at mailsnare dot net @ 2009-07-16 21:22 UTC (permalink / raw)
  To: gcc-bugs

i found a corner case, definitely odd but legal, in basic_string::_M_disjunct. 
consider the following:

string s1("abcd");
string s2(s1); // make it shared
s1.append(s.data() - 1, 5);

_M_disjunct should return true but, because it does not check the length,
fails.

i created a patch for this but see no where to attach it.


-- 
           Summary: basic_string::_M_disjunct corner case
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jkt at mailsnare dot net
  GCC host triplet: x86_64-suse-linux


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


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

* [Bug libstdc++/40779] basic_string::_M_disjunct corner case
  2009-07-16 21:22 [Bug libstdc++/40779] New: basic_string::_M_disjunct corner case jkt at mailsnare dot net
@ 2009-07-16 21:23 ` jkt at mailsnare dot net
  2009-07-16 21:27 ` jkt at mailsnare dot net
  2009-07-16 22:02 ` paolo dot carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: jkt at mailsnare dot net @ 2009-07-16 21:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jkt at mailsnare dot net  2009-07-16 21:23 -------
Created an attachment (id=18211)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18211&action=view)
patch for basic_string::_M_disjunct corner case


-- 


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


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

* [Bug libstdc++/40779] basic_string::_M_disjunct corner case
  2009-07-16 21:22 [Bug libstdc++/40779] New: basic_string::_M_disjunct corner case jkt at mailsnare dot net
  2009-07-16 21:23 ` [Bug libstdc++/40779] " jkt at mailsnare dot net
@ 2009-07-16 21:27 ` jkt at mailsnare dot net
  2009-07-16 22:02 ` paolo dot carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: jkt at mailsnare dot net @ 2009-07-16 21:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jkt at mailsnare dot net  2009-07-16 21:27 -------
correction:

_M_disjunct should return false because the source and target are conjunct
(overlap).


-- 


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


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

* [Bug libstdc++/40779] basic_string::_M_disjunct corner case
  2009-07-16 21:22 [Bug libstdc++/40779] New: basic_string::_M_disjunct corner case jkt at mailsnare dot net
  2009-07-16 21:23 ` [Bug libstdc++/40779] " jkt at mailsnare dot net
  2009-07-16 21:27 ` jkt at mailsnare dot net
@ 2009-07-16 22:02 ` paolo dot carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-07-16 22:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot carlini at oracle dot com  2009-07-16 22:01 -------
> s1.append(s.data() - 1, 5);

What's s? If, as I believe, it's a std::basic_string - s1, s2, whatever - on
which you are calling the data member function, the line is definitely illegal,
because s.data() - 1 doesn't point to a char belonging to the string. Actually,
what's so special about -1? If that line were legal you could pass to append
*any* address, meaningless.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2009-07-16 22:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-16 21:22 [Bug libstdc++/40779] New: basic_string::_M_disjunct corner case jkt at mailsnare dot net
2009-07-16 21:23 ` [Bug libstdc++/40779] " jkt at mailsnare dot net
2009-07-16 21:27 ` jkt at mailsnare dot net
2009-07-16 22:02 ` paolo dot carlini at oracle dot com

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).