public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/66199] New: [4.9/5 Regression] lastprivate/linear clause issues on combined constructs
@ 2015-05-19  9:33 jakub at gcc dot gnu.org
  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
  0 siblings, 2 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-05-19  9:33 UTC (permalink / raw)
  To: gcc-bugs

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;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/66199] [4.9/5 Regression] lastprivate/linear clause issues on combined constructs
  2015-05-19  9:33 [Bug middle-end/66199] New: [4.9/5 Regression] lastprivate/linear clause issues on combined constructs jakub at gcc dot gnu.org
@ 2015-05-22  8:11 ` jakub at gcc dot gnu.org
  2015-10-16  8:22 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-05-22  8:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri May 22 08:10:32 2015
New Revision: 223521

URL: https://gcc.gnu.org/viewcvs?rev=223521&root=gcc&view=rev
Log:
        Backported from mainline
        2015-05-19  Jakub Jelinek  <jakub@redhat.com>

        PR middle-end/66199
        * tree.h (OMP_TEAMS_COMBINED): Define.
        * gimplify.c (enum gimplify_omp_var_data): Add
        GOVD_LINEAR_LASTPRIVATE_NO_OUTER.
        (enum omp_region_type): Add ORT_COMBINED_TEAMS.
        (omp_notice_variable): Accept both ORT_TEAMS
        and ORT_COMBINED_TEAMS.  Don't recurse if
        GOVD_LINEAR_LASTPRIVATE_NO_OUTER is set and either
        GOVD_LINEAR is set, or GOVD_LASTPRIVATE without
        GOVD_FIRSTPRIVATE.
        (omp_no_lastprivate): New function.
        (gimplify_scan_omp_clauses): For OMP_CLAUSE_LASTPRIVATE
        and OMP_CLAUSE_LINEAR, if omp_no_lastprivate, don't
        notice_outer and set appropriate bits, otherwise make
        sure default(none) combined constructs won't complain.
        (gimplify_adjust_omp_clauses): Remove OMP_CLAUSE_LINEAR
        outer special casing, for OMP_CLAUSE_LASTPRIVATE if
        omp_no_lastprivate either remove the clause or turn it
        into OMP_CLAUSE_PRIVATE.
        (gimplify_omp_for): Fix up handling of implicit
        lastprivate or linear iterators.
        (gimplify_omp_workshare): For OMP_TEAMS_COMBINED use
        ORT_COMBINED_TEAMS.
        * omp-low.c (lower_omp_for_lastprivate): For combined
        for simd use fd.loop.n2 from the for rather than simd.
gcc/c/
        * c-parser.c (c_parser_omp_for_loop): Don't add
        OMP_CLAUSE_SHARED to OMP_PARALLEL_CLAUSES when moving
        OMP_CLAUSE_LASTPRIVATE clause to OMP_FOR_CLAUSES.
        (c_parser_omp_teams): Set OMP_TEAMS_COMBINED for combined
        constructs.
gcc/cp/
        * parser.c (cp_parser_omp_for_loop): Don't add
        OMP_CLAUSE_SHARED to OMP_PARALLEL_CLAUSES when moving
        OMP_CLAUSE_LASTPRIVATE clause to OMP_FOR_CLAUSES.
        (cp_parser_omp_teams): Set OMP_TEAMS_COMBINED for combined
        constructs.
gcc/fortran/
        * trans-openmp.c (gfc_trans_omp_teams): Set OMP_TEAMS_COMBINED for
        combined constructs.
        (gfc_trans_omp_target): Make sure BIND_EXPR has non-NULL
        BIND_EXPR_BLOCK.
libgomp/
        * testsuite/libgomp.c/pr66199-1.c: New test.
        * testsuite/libgomp.c/pr66199-2.c: New test.
        * testsuite/libgomp.c++/pr66199-1.C: New test.
        * testsuite/libgomp.c++/pr66199-2.C: New test.
        * testsuite/libgomp.fortran/pr66199-1.f90: New test.
        * testsuite/libgomp.fortran/pr66199-2.f90: New test.

Added:
    branches/gcc-5-branch/libgomp/testsuite/libgomp.c++/pr66199-1.C
    branches/gcc-5-branch/libgomp/testsuite/libgomp.c++/pr66199-2.C
    branches/gcc-5-branch/libgomp/testsuite/libgomp.c/pr66199-1.c
    branches/gcc-5-branch/libgomp/testsuite/libgomp.c/pr66199-2.c
    branches/gcc-5-branch/libgomp/testsuite/libgomp.fortran/pr66199-1.f90
    branches/gcc-5-branch/libgomp/testsuite/libgomp.fortran/pr66199-2.f90
Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/c/ChangeLog
    branches/gcc-5-branch/gcc/c/c-parser.c
    branches/gcc-5-branch/gcc/cp/ChangeLog
    branches/gcc-5-branch/gcc/cp/parser.c
    branches/gcc-5-branch/gcc/fortran/ChangeLog
    branches/gcc-5-branch/gcc/fortran/trans-openmp.c
    branches/gcc-5-branch/gcc/gimplify.c
    branches/gcc-5-branch/gcc/omp-low.c
    branches/gcc-5-branch/gcc/tree.h
    branches/gcc-5-branch/libgomp/ChangeLog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/66199] [4.9/5 Regression] lastprivate/linear clause issues on combined constructs
  2015-05-19  9:33 [Bug middle-end/66199] New: [4.9/5 Regression] lastprivate/linear clause issues on combined constructs jakub at gcc dot gnu.org
  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
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-10-16  8:22 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-16  8:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-19  9:33 [Bug middle-end/66199] New: [4.9/5 Regression] lastprivate/linear clause issues on combined constructs jakub at gcc dot gnu.org
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

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).