This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

optimization/7351: Postincrment optimisation problem


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]