[Bug middle-end/23295] New: fold does not simplify -a - (5) to (-5) - a

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Aug 9 03:12:00 GMT 2005


Take the following function:
int f(int a, int c)
{
  return -a - (5);
}

Fold should have converted that to:
int f(int a, int c)
{
  return (-5) - a;
}

So that we only have one constant (-5) and one decl (a) and one expression (MINUS_EXPR) instead
of one constant (5), one decl (a) and two expressions (MINUS_EXPR and NEG_EXPR).

-- 
           Summary: fold does not simplify -a - (5) to (-5) - a
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23295



More information about the Gcc-bugs mailing list