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
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.
Already in gcc4-4.1.2-42.EL4 (and in RHEL5), will backport to gcc-3.4.6-RH too.
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