https://bugs.llvm.org/show_bug.cgi?id=45132

            Bug ID: 45132
           Summary: OpenMP doacross loop nest with a decreasing induction
                    variable abends
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: OpenMP
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]

Created attachment 23210
  --> https://bugs.llvm.org/attachment.cgi?id=23210&action=edit
doacross.1.c in OpenMP 4.5 exmaples with reverse-order modification

[Envinronment]
OS: Linux
CPU: x86_64 and AArch64
LLVM/Clang/OpenMP: latest master branch (commit cfff4851acc)

The attached program `doacross.reverse.c` is a modified version of
`doacross.1.c` in the official 'OpenMP Examples Version 4.5.0' (page 194)
<https://github.com/OpenMP/Examples/blob/v4.5.0/sources/Example_doacross.1.c>.

The modified points are:

- decrease the induction variable `i` (see the diff below)
- change `depend(sink: i+1)` to depend(sink: i-1) (see the diff below)
- implement `foo`, `bar`, `baz`, and `main`

--------------------------------
   #pragma omp for ordered(1)
-  for (i=N-1; i>1; i--)
+  for (i=1; i<N; i++)
   {
     A[i] = foo(i);

-    #pragma omp ordered depend(sink: i+1)
+    #pragma omp ordered depend(sink: i-1)
     B[i] = bar(A[i], B[i-1]);
     #pragma omp ordered depend(source)

     C[i] = baz(B[i]);
   }
--------------------------------

When this program is compiled with -fopenmp and executed, a segmentation fault
occurs.

--------------------------------
$ clang -fopenmp doacross.reverse.c
$ ./a.out
Segmentation fault
--------------------------------

The number of threads is irrelevant. I can reproduce it with OMP_NUM_THREADS=2.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to