lebedev.ri requested changes to this revision.
lebedev.ri added a comment.
This revision now requires changes to proceed.

In D109321#2985244 <https://reviews.llvm.org/D109321#2985244>, @peixin wrote:

> The following test case fails after 
> https://reviews.llvm.org/rGaf000197c4214926bd7d0862d86f89aed5f20da6.
>
>   #include <iostream>
>   using namespace std;
>   
>   int main() {
>     float a[10];
>     int i, N = 10;
>     for (i = 0; i < N; i++)
>       a[i] = 0;
>   
>     #pragma omp simd
>     for (i = 0; i < N; i++) {
>       #pragma omp ordered simd
>       a[i] = a[i-1] + 1.0;
>     }
>   
>     for (i = 0; i < N; i++)
>       cout << a[i] << "  ";
>     cout << endl;
>   }
>
>
>
>   $ clang++ -fopenmp simd.cpp && ./a.out
>   1  2  3  4  5  6  7  8  9  10
>   $ clang++ -fopenmp -O1 simd.cpp && ./a.out
>   1  1  1  1  2  1  1  1  2  3
>
> It is fixed by this patch.

That's UB; https://godbolt.org/z/5nb61G3vY

  /app/example.cpp:13:12: runtime error: index -1 out of bounds for type 'float 
[10]'
  SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior 
/app/example.cpp:13:12 in 
  1  2  3  4  5  6  7  8  9  10  

Do you have an example that is miscompiled and doesn't contain UB?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109321/new/

https://reviews.llvm.org/D109321

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to