Bug 52839 - incorrect optimzation with preincrement
Summary: incorrect optimzation with preincrement
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 7.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-08-29 20:03 UTC by Need Real Name
Modified: 2007-04-18 16:36 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-08-29 20:04:59 UTC
Embargoed:


Attachments (Terms of Use)
Simple demo of preincrement optimization error under gcc (557 bytes, text/plain)
2001-08-29 20:04 UTC, Need Real Name
no flags Details

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.


Note You need to log in before you can comment on or make changes to this bug.