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 tree-optimization/52267] New: a&~N where N has all the bits set up till a specific point can be folded to ((unsigned)a) < N


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

             Bug #: 52267
           Summary: a&~N where N has all the bits set up till a specific
                    point can be folded to ((unsigned)a) < N
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pinskia@gcc.gnu.org


Take the following two functions.
int f(int a, int b)
{
  if (a>3||a<0) return a;
  a&=3;
  return a&3;
}

int f1(int a)
{
  if (a&~03)  return a;
  return a&3;
}

They should return just the argument.  Right now the first function does but
not the second.


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