Bugzilla will be upgraded to version 5.0 on December 2, 2018. The outage period for the upgrade will start at 0:00 UTC and have a duration of 12 hours
Bug 52839 - incorrect optimzation with preincrement
incorrect optimzation with preincrement
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
Depends On:
  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:
Last Closed: 2001-08-29 16:04:59 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
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:

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

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, 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.