Bug 52839

Summary: incorrect optimzation with preincrement
Product: [Retired] Red Hat Linux Reporter: Need Real Name <medbi01>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-08-29 20:04:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Simple demo of preincrement optimization error under gcc none

Description Need Real Name 2001-08-29 20:03:03 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows 95)

Description of problem:
The following is incorrectly optimised under 2.96-85:

(*s == *(++s))

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.Compile attached code with and without -O2
2.Compare the results of running
3.
	

Actual Results:  Result depends on whether the O2 option is specified

Expected Results:  Result should always be correct

Additional info:

This was under gcc 2.96-85

Comment 1 Need Real Name 2001-08-29 20:04:55 UTC
Created attachment 30114 [details]
Simple demo of preincrement optimization error under gcc

Comment 2 Jakub Jelinek 2001-08-30 07:49:43 UTC
Why do you think it is incorrectly optimized?
ISO C does not require a sequence point after the left operand of == operator
(see ISO C99 5.1.2.3, 6.5/3 and the whole ISO C99 Annex C), so gcc is allowed
to evaluate the two operands to == operator in any order it wants.