Bug 394271 - gcc optimization error for neg number * abs() [extract_muldiv]
gcc optimization error for neg number * abs() [extract_muldiv]
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gcc (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2007-11-21 10:18 EST by Jan Iven
Modified: 2010-10-22 16:37 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-05-18 16:33:43 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 34130 None None None Never

  None (edit)
Description Jan Iven 2007-11-21 10:18:35 EST
As reported on http://linux.solidot.org/article.pl?sid=07/11/19/0512218&from=rss
and http://lkml.org/lkml/2007/11/19/493, the following test program triggers 
an optimization bug in gcc for the builtin abs() function:

int main () {
                int i=2;
                if( -10*abs (i-1) == 10*abs(i-1) )
                                printf ("OMG,-10==10 in linux!\n");
                                printf ("nothing special here\n");

Verified with RHEL4 (gcc-3.4.6-8), RHEL5 (gcc-4.1.2-14.el5), F8 (gcc-4.1.2-33).
Upstream patch at
Comment 2 RHEL Product and Program Management 2008-09-05 13:21:26 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
Comment 3 Jakub Jelinek 2008-09-30 12:22:11 EDT
Already in gcc4-4.1.2-42.EL4 (and in RHEL5), will backport to gcc-3.4.6-RH too.
Comment 11 errata-xmlrpc 2009-05-18 16:33:43 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.


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