This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]