------- Comment #2 from pinskia at gcc dot gnu dot org  2005-12-02 00:10 -------
Note the warning is that bogus, take the following example:
float a(void)
{
        float i;
        float granularity = 0.01f;
        float dist = 0;
        float vec[2] = {0,0};
        float lastPoint;
        float result;

        for(i = 0; i <= 1.f; i += granularity ) {

                result = vec[1] - vec[0];

                if( i != 0 ) {
                        vec[0] = result - lastPoint;
                        dist += vec[0];
                }

                lastPoint = result;
        }
        return dist;
}

We get the same warning.  For the mainline, we get no warning as we are jump
threading so that the if (i!=0) is removed for the first iteration of the loop.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |24639
              nThis|                            |
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
      Known to fail|                            |4.0.0 4.0.3
      Known to work|                            |4.1.0 3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2005-12-02 00:10:15
               date|                            |
            Summary|gcc 4.0.2 gives bogus 'may  |[4.0 Regression] bogus 'may
                   |be uninit warnings' at -O3  |be uninit warnings' for
                   |                            |loops
   Target Milestone|---                         |4.0.3


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

Reply via email to