Bug 394271

Summary: gcc optimization error for neg number * abs() [extract_muldiv]
Product: Red Hat Enterprise Linux 4 Reporter: Jan Iven <jan.iven>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 4.0CC: k.georgiou, mnowak, pmuller, rdassen, riek, tao
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-18 20:33:43 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:

Description Jan Iven 2007-11-21 15:18:35 UTC
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");
                else
                                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
http://www.nabble.com/-PATCH--Fix-PR34130,-extract_muldiv-broken-t4826688.html

Comment 2 RHEL Program Management 2008-09-05 17:21:26 UTC
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
release.

Comment 3 Jakub Jelinek 2008-09-30 16:22:11 UTC
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 20:33:43 UTC
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.

http://rhn.redhat.com/errata/RHBA-2009-1016.html