This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
ada/6713: Regression wrt 3.0.4: g++ -O2 leads to seg fault at run time
- From: pcarlini at unitus dot it
- To: gcc-gnats at gcc dot gnu dot org
- Cc: mark at ecriticalinc dot com
- Date: 18 May 2002 08:45:16 -0000
- Subject: ada/6713: Regression wrt 3.0.4: g++ -O2 leads to seg fault at run time
- Reply-to: pcarlini at unitus dot it
>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: