Empty loops where the loop index is an integer are optimized away, but the
following loop is not (presumably because it is more difficult to prove that it
terminates in finite time?)

int main()
{
        for(double i=0; i<1e9; i+=1);
}

Command line: g++ -O3


-- 
           Summary: G++ doesn't optimize away empty loop when index is a
                    double
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: evouga at gmail dot com


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

Reply via email to