ada/6713: Regression wrt 3.0.4: g++ -O2 leads to seg fault at run time
pcarlini@unitus.it
pcarlini@unitus.it
Sat May 18 01:46:00 GMT 2002
>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:
More information about the Gcc-bugs
mailing list