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



             Bug #: 55814

           Summary: Missed optimization with short-circuit evaluation

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: enhancement

          Priority: P3

         Component: middle-end

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: tkoe...@gcc.gnu.org





See PR 55806.



The Fortran front end generates code for intrinsics like ANY and ALL

which looks like (after loop unrolling)



_Bool foo(int *a, int *b)

{

  _Bool f0, f1, f2, f3;



  f0 = a[0] > b[0];

  f1 = a[1] > b[1];

  f2 = a[2] > b[2];

  f3 = a[2] > b[2];



  return f0 || f1 || f2 || f3;

}



There should be no need to perform the second comparison if the

first one is true.

Reply via email to