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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Last reconfirmed|2012-02-23 00:00:00         |
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|                            |INVALID
            Summary|OpenMP incorrectly          |[4.5/4.6/4.7] OpenMP
                   |parallelizes loops (wrong   |incorrectly parallelizes
                   |iteration count)            |loops (wrong iteration
                   |                            |count)
      Known to fail|4.3.6, 4.4.6, 4.5.3, 4.6.2, |
                   |4.7.0                       |

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-23 
10:32:48 UTC ---
The first case is not valid OpenMP code.
See e.g. OpenMP 2.5, in section 2.5.1:
"Note that the canonical form allows the number of loop iterations to be
computed on entry to the loop. This computation is performed with values in the
type of var, after integral promotions. In particular, if the value of b - lb +
incr, or any intermediate result required to compute this value, cannot be
represented in that type, the behavior is unspecified."

The number of iterations here is (INT32_MAX - 1) - INT32_MIN + 1, but it and
any of its temporaries are supposed to be computed in the int type.  That is
unspecified behavior, you just can't have more than INT32_MAX iterations in a
valid OpenMP loop with int IV type.

Reply via email to