Bug 52839 - incorrect optimzation with preincrement
incorrect optimzation with preincrement
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-08-29 16:03 EDT by Need Real Name
Modified: 2007-04-18 12:36 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-08-29 16:04:59 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Need Real Name 2001-08-29 16:03:03 EDT
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 16:04:55 EDT
Created attachment 30114 [details]
Simple demo of preincrement optimization error under gcc
Comment 2 Jakub Jelinek 2001-08-30 03:49:43 EDT
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.