diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-14 20:36:00 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-14 20:36:00 +0000 |
| commit | 0d8fcdf11a237fc463598050c23a57d5db8d8f65 (patch) | |
| tree | 01d0f01d93f7ea80f58464d4ff959722332b780b /clang/test/OpenMP/ordered_doacross_codegen.cpp | |
| parent | c4420b00f1028d674935d8515f9af29619f2651e (diff) | |
| download | bcm5719-llvm-0d8fcdf11a237fc463598050c23a57d5db8d8f65.tar.gz bcm5719-llvm-0d8fcdf11a237fc463598050c23a57d5db8d8f65.zip | |
[OPENMP]Fix crash for the ordered(n) clause.
If the doacross lop construct is used and the loop counter is declare
outside of the loop, the compiler might crash trying to get the address
of the loop counter. Patch fixes this problem.
llvm-svn: 356198
Diffstat (limited to 'clang/test/OpenMP/ordered_doacross_codegen.cpp')
| -rw-r--r-- | clang/test/OpenMP/ordered_doacross_codegen.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/test/OpenMP/ordered_doacross_codegen.cpp b/clang/test/OpenMP/ordered_doacross_codegen.cpp index 2f19e9c2d5e..a3abf248d76 100644 --- a/clang/test/OpenMP/ordered_doacross_codegen.cpp +++ b/clang/test/OpenMP/ordered_doacross_codegen.cpp @@ -16,6 +16,17 @@ extern int n; int a[10], b[10], c[10], d[10]; void foo(); +// CHECK-LABEL:bar +void bar() { + int i,j; +// CHECK: call void @__kmpc_doacross_init( +// CHECK: call void @__kmpc_doacross_fini( +#pragma omp parallel for ordered(2) + for (i = 0; i < n; ++i) + for (j = 0; j < n; ++j) + a[i] = b[i] + 1; +} + // CHECK-LABEL: @main() int main() { int i; @@ -35,7 +46,7 @@ int main() { // CHECK: call void @__kmpc_doacross_init([[IDENT]], i32 [[GTID]], i32 1, i8* [[CAST]]) // CHECK: call void @__kmpc_for_static_init_4( #pragma omp for ordered(1) - for (i = 0; i < n; ++i) { + for (int i = 0; i < n; ++i) { a[i] = b[i] + 1; foo(); // CHECK: invoke void [[FOO:.+]]( |

