public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgomp/52348] [4.5/4.6/4.7] OpenMP incorrectly parallelizes loops (wrong iteration count)
Date: Thu, 23 Feb 2012 10:39:00 -0000	[thread overview]
Message-ID: <bug-52348-4-lhttSEmjR2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52348-4@http.gcc.gnu.org/bugzilla/>

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.


  parent reply	other threads:[~2012-02-23 10:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-23  9:22 [Bug libgomp/52348] New: [4.5/4.6] " ua_gcc_bugzilla@binary-island.eu
2012-02-23  9:53 ` [Bug libgomp/52348] [4.5/4.6/4.7] " ua_gcc_bugzilla@binary-island.eu
2012-02-23 10:08 ` [Bug libgomp/52348] " rguenth at gcc dot gnu.org
2012-02-23 10:29 ` ua_gcc_bugzilla@binary-island.eu
2012-02-23 10:39 ` jakub at gcc dot gnu.org [this message]
2012-02-23 10:47 ` [Bug libgomp/52348] [4.5/4.6/4.7] " ua_gcc_bugzilla@binary-island.eu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-52348-4-lhttSEmjR2@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).