This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/9062: gcc 3.2.0, 3.2.1 optimization bug with postincrement
- From: andrej dot filipcic at ijs dot si
- To: gcc-gnats at gcc dot gnu dot org
- Date: 27 Dec 2002 00:46:49 -0000
- Subject: c++/9062: gcc 3.2.0, 3.2.1 optimization bug with postincrement
- Reply-to: andrej dot filipcic at ijs dot si
>Number: 9062
>Category: c++
>Synopsis: gcc 3.2.0, 3.2.1 optimization bug with postincrement
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Dec 26 16:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: andrej.filipcic@ijs.si
>Release: unknown-1.0
>Organization:
>Environment:
redhat 8.0
>Description:
The following code miscompiles with "g++ -O2" gcc-3.2.0, gcc-3.2.1. "-O0,1,3" gives correct results. Output of "-O2"
is "bcdefgh" instead of "abcdefgh"
Equivalent in c only works with "-O1".
----------------------
#include <iostream>
using namespace std;
void str2lower(char *p) {
while(*p) *p++=tolower(*p);
}
int main() {
char str[]="Abcdefgh";
str2lower(str);
cout<<str<<endl;
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: