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 middle-end/66199] New: [4.9/5 Regression] lastprivate/linear clause issues on combined constructs
Date: Tue, 19 May 2015 09:33:00 -0000	[thread overview]
Message-ID: <bug-66199-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66199

            Bug ID: 66199
           Summary: [4.9/5 Regression] lastprivate/linear clause issues on
                    combined constructs
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Keywords: rejects-valid, wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: jakub at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

The following testcase is incorrectly rejected in 4.9/5, eventhough the
variables are either explicitly or implicitly mentioned on the combined
construct.
There is also a wrong-code issue in f3/f4 if default(none) clause is removed.

int u[1024], v[1024], w[1024], m;

__attribute__((noinline, noclone)) long
f1 (long a, long b)
{
  long d;
  #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v,
w)
  for (d = a; d < b; d++)
    u[d] = v[d] + w[d];
  return d;
}

__attribute__((noinline, noclone)) long
f2 (long a, long b, long c)
{
  long d;
  #pragma omp parallel for simd default(none) firstprivate (a, b) shared(u, v,
w) linear(d) linear(c:5)
  for (d = a; d < b; d++)
    {
      u[d] = v[d] + w[d];
      c += 5;
    }
  return d + c;
}

__attribute__((noinline, noclone)) long
f3 (long a1, long b1, long a2, long b2)
{
  long d1, d2;
  #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2)
shared(u, v, w) lastprivate(d1, d2) collapse(2)
  for (d1 = a1; d1 < b1; d1++)
    for (d2 = a2; d2 < b2; d2++)
      u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
  return d1 + d2;
}

__attribute__((noinline, noclone)) long
f4 (long a1, long b1, long a2, long b2)
{
  long d1, d2;
  #pragma omp parallel for simd default(none) firstprivate (a1, b1, a2, b2)
shared(u, v, w) collapse(2)
  for (d1 = a1; d1 < b1; d1++)
    for (d2 = a2; d2 < b2; d2++)
      u[d1 * 32 + d2] = v[d1 * 32 + d2] + w[d1 * 32 + d2];
  return d1 + d2;
}

int
main ()
{
  if (f1 (0, 1024) != 1024
      || f2 (0, 1024, 17) != 1024 + 17 + 5 * 1024
      || f3 (0, 32, 0, 32) != 64
      || f4 (0, 32, 0, 32) != 64)
    __builtin_abort ();
  return 0;
}


             reply	other threads:[~2015-05-19  9:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-19  9:33 jakub at gcc dot gnu.org [this message]
2015-05-22  8:11 ` [Bug middle-end/66199] " jakub at gcc dot gnu.org
2015-10-16  8:22 ` rguenth at gcc dot gnu.org

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-66199-4@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).