optimization/7351: Postincrment optimisation problem
geert.deprins@advalvas.be
geert.deprins@advalvas.be
Thu Jul 18 12:46:00 GMT 2002
>Number: 7351
>Category: optimization
>Synopsis: Postincrment optimisation problem
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jul 18 10:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Geert De Prins
>Release: 3.0.3
>Organization:
>Environment:
Solaris 2.7
>Description:
Optimiser with -O2 level on seems to increment the pointer used in the source operand to early.
Sample code below (with -O2 the first character is missing):
#include <stdio.h>
void main()
{
char szBuffer[256];
char *p_cTag = szBuffer;
strcpy(szBuffer,"Testtekst");
while(*p_cTag) /* scan from start to convert to uppercase */
{
*(p_cTag++) = toupper(*p_cTag);
}
printf("Result:%s",szBuffer);
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list