public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* ada/6713: Regression wrt 3.0.4: g++ -O2 leads to seg fault at run time
@ 2002-05-18  1:46 pcarlini
  0 siblings, 0 replies; only message in thread
From: pcarlini @ 2002-05-18  1:46 UTC (permalink / raw)
  To: gcc-gnats; +Cc: mark


>Number:         6713
>Category:       ada
>Synopsis:       Regression wrt 3.0.4: g++ -O2 leads to seg fault at run time
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 18 01:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Paolo Carlini / Mark Whitehouse
>Release:        3.1, also 3.2 20020517
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
This short snippet seg faults if compiled -O2
///////////////
#include <string>

int
isspa(int ch)
{
  return 0;
}

void foo(std::string& str)
{
  std::string::iterator it  = str.begin();
  std::string::iterator stop = str.end();
  for (; it != stop; ++it )
  //for (std::string::iterator it  = str.begin(); it != str.end(); ++it )
    if ( isspa( *it ) ) break;
}

int main()
{
  std::string str = "test";
  foo(str);
}
////////////////
>How-To-Repeat:
Interestingly, using the alternate form of the for statement makes the problem go away.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-05-18  8:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-18  1:46 ada/6713: Regression wrt 3.0.4: g++ -O2 leads to seg fault at run time pcarlini

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