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

            Bug ID: 57371
           Summary: Simplify (double)i != 0
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org

int f(int i){
  return (double)i != 0;
}

compiled with -Ofast (I don't think -ffast-math matters) keeps the conversion
to double. I think returning i != 0 is always valid. I didn't think long about
the exact set of circumstances where it is ok.

Reply via email to