public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/109013] New: [OpenMP] Diagnose if multiple 'omp ordered' appear in a loop body
@ 2023-03-03 17:04 burnus at gcc dot gnu.org
  2023-03-03 17:25 ` [Bug middle-end/109013] " jakub at gcc dot gnu.org
  2023-03-03 18:03 ` jakub at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2023-03-03 17:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109013
           Summary: [OpenMP] Diagnose if multiple 'omp ordered' appear in
                    a loop body
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: diagnostic, openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

The following code is accepted – while clang errors with:

test.c:18:5: error: exactly one 'ordered' directive must appear in the loop
body of an enclosing directive

Cf. "Additional restrictions to the block-associated ordered construct are as
follows:"
...
"During execution of the logical iteration of a loop-associated construct, a
thread must not execute more than one block-associated ordered region that
binds to the corresponding region of the loop-associated construct."



int a[10];

void foo(int n)
{
#if 0
  #pragma omp for ordered schedule(static)
  #pragma omp unroll partial(2)
  for(int i = 1; i < n; i++) {
    #pragma omp ordered
       a[i] += a[i-1];
  }
  // ->
#endif
  #pragma omp for ordered schedule(static)
  for(int i = 1; i < n; i += 2) {
    #pragma omp ordered
       a[i] += a[i-1];
    #pragma omp ordered
       a[i+1] += a[i];
  }
}

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

* [Bug middle-end/109013] [OpenMP] Diagnose if multiple 'omp ordered' appear in a loop body
  2023-03-03 17:04 [Bug middle-end/109013] New: [OpenMP] Diagnose if multiple 'omp ordered' appear in a loop body burnus at gcc dot gnu.org
@ 2023-03-03 17:25 ` jakub at gcc dot gnu.org
  2023-03-03 18:03 ` jakub at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-03 17:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is not easy, because it is only invalid if one ordered dominates the other
(so we need cfg to find that out) and further more it is an execution time
restriction, so it is unclear if we can error, perhaps just warn?

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

* [Bug middle-end/109013] [OpenMP] Diagnose if multiple 'omp ordered' appear in a loop body
  2023-03-03 17:04 [Bug middle-end/109013] New: [OpenMP] Diagnose if multiple 'omp ordered' appear in a loop body burnus at gcc dot gnu.org
  2023-03-03 17:25 ` [Bug middle-end/109013] " jakub at gcc dot gnu.org
@ 2023-03-03 18:03 ` jakub at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-03 18:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Even the dominating case could be valid.
E.g. if the body does
#pragma omp ordered
foo ();
bar ();
#pragma omp ordered
baz ();
where bar () calls exit (0);

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

end of thread, other threads:[~2023-03-03 18:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 17:04 [Bug middle-end/109013] New: [OpenMP] Diagnose if multiple 'omp ordered' appear in a loop body burnus at gcc dot gnu.org
2023-03-03 17:25 ` [Bug middle-end/109013] " jakub at gcc dot gnu.org
2023-03-03 18:03 ` jakub 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).