public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/8356: Operator precedence-- dereferencing an incremented iterator
@ 2002-10-25 9:57 bangerth
0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2002-10-25 9:57 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, jddahl, nobody
Synopsis: Operator precedence-- dereferencing an incremented iterator
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Fri Oct 25 09:57:54 2002
State-Changed-Why:
You are modifying the iterator more than once within one
statement. Since the order of modification and evaluation of
the iterator is not specified, you are invoking undefined
behavior.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8356
^ permalink raw reply [flat|nested] 2+ messages in thread
* libstdc++/8356: Operator precedence-- dereferencing an incremented iterator
@ 2002-10-25 9:36 jddahl
0 siblings, 0 replies; 2+ messages in thread
From: jddahl @ 2002-10-25 9:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 8356
>Category: libstdc++
>Synopsis: Operator precedence-- dereferencing an incremented iterator
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Oct 25 09:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: jddahl@micron.com
>Release: GCC 3.2
>Organization:
>Environment:
>Description:
#include <set>
#include <string>
#include <iostream>
using namespace::std;
int main( )
{
set<string> mySet;
set<string>::const_iterator iter;
mySet.insert( "This" );
mySet.insert( "is" );
mySet.insert( "mySet" );
iter = mySet.begin( );
cout << *iter++ << " " << *iter++ << " " << *iter << endl;
iter = mySet.begin( );
cout << *iter++ << " " << *iter++ << " " << *iter++ << endl;
iter = mySet.begin( );
cout << *iter << " " << *(++iter) << " " << *(++iter) << endl;
//WORKAROUND
iter = mySet.begin( );
cout << *iter << " ";
iter++;
cout << *iter << " ";
iter++;
cout << *iter << endl;
}
OUTPUT:
is This This
mySet is This
mySet mySet is
This is mySet
>How-To-Repeat:
Compile submitted code and run.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-10-25 16:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-25 9:57 libstdc++/8356: Operator precedence-- dereferencing an incremented iterator bangerth
-- strict thread matches above, loose matches on Subject: below --
2002-10-25 9:36 jddahl
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).