From d6a5bd12cc98063fe0fcef2363964f905a6a5183 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 13 Nov 2017 23:34:53 +0000 Subject: Merging r312292: ------------------------------------------------------------------------ r312292 | abataev | 2017-08-31 16:06:52 -0700 (Thu, 31 Aug 2017) | 8 lines [OPENMP] Fix for PR34398: assert with random access iterator if the step>1. If the loop is a loot with random access iterators and the iteration construct is represented it += n, then the compiler crashed because of reusing of the same MaterializedTemporaryExpr around N. Patch fixes it by using the expression as written, without any special kind of wrappings. ------------------------------------------------------------------------ llvm-svn: 318113 --- clang/lib/Sema/SemaOpenMP.cpp | 4 ++-- .../OpenMP/distribute_parallel_for_simd_loop_messages.cpp | 2 +- clang/test/OpenMP/distribute_simd_loop_messages.cpp | 2 +- clang/test/OpenMP/for_codegen.cpp | 12 ++++++++++++ clang/test/OpenMP/for_loop_messages.cpp | 2 +- clang/test/OpenMP/for_simd_loop_messages.cpp | 2 +- clang/test/OpenMP/parallel_for_loop_messages.cpp | 2 +- clang/test/OpenMP/parallel_for_simd_loop_messages.cpp | 2 +- clang/test/OpenMP/simd_loop_messages.cpp | 2 +- clang/test/OpenMP/target_parallel_for_loop_messages.cpp | 2 +- clang/test/OpenMP/target_parallel_for_simd_loop_messages.cpp | 2 +- clang/test/OpenMP/target_simd_loop_messages.cpp | 2 +- clang/test/OpenMP/target_teams_distribute_loop_messages.cpp | 2 +- .../target_teams_distribute_parallel_for_loop_messages.cpp | 2 +- ...rget_teams_distribute_parallel_for_simd_loop_messages.cpp | 2 +- .../OpenMP/target_teams_distribute_simd_loop_messages.cpp | 2 +- clang/test/OpenMP/taskloop_loop_messages.cpp | 2 +- clang/test/OpenMP/taskloop_simd_loop_messages.cpp | 2 +- clang/test/OpenMP/teams_distribute_loop_messages.cpp | 2 +- .../OpenMP/teams_distribute_parallel_for_loop_messages.cpp | 2 +- .../teams_distribute_parallel_for_simd_loop_messages.cpp | 2 +- clang/test/OpenMP/teams_distribute_simd_loop_messages.cpp | 2 +- 22 files changed, 34 insertions(+), 22 deletions(-) diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 38cb45431668..b57a72eb9cd3 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -3111,8 +3111,8 @@ bool OpenMPIterationSpaceChecker::SetStep(Expr *NewStep, bool Subtract) { if (!NewStep->isValueDependent()) { // Check that the step is integer expression. SourceLocation StepLoc = NewStep->getLocStart(); - ExprResult Val = - SemaRef.PerformOpenMPImplicitIntegerConversion(StepLoc, NewStep); + ExprResult Val = SemaRef.PerformOpenMPImplicitIntegerConversion( + StepLoc, getExprAsWritten(NewStep)); if (Val.isInvalid()) return true; NewStep = Val.get(); diff --git a/clang/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp b/clang/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp index 6c322e6f60be..1fedb3c02d79 100644 --- a/clang/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp +++ b/clang/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp @@ -702,7 +702,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/distribute_simd_loop_messages.cpp b/clang/test/OpenMP/distribute_simd_loop_messages.cpp index b69005578f49..59fafda45f4b 100644 --- a/clang/test/OpenMP/distribute_simd_loop_messages.cpp +++ b/clang/test/OpenMP/distribute_simd_loop_messages.cpp @@ -691,7 +691,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/for_codegen.cpp b/clang/test/OpenMP/for_codegen.cpp index b27bd7b1dbe5..7d823ed2052e 100644 --- a/clang/test/OpenMP/for_codegen.cpp +++ b/clang/test/OpenMP/for_codegen.cpp @@ -484,6 +484,18 @@ void loop_with_It(It begin, It end) { // CHECK: call void @__kmpc_for_static_init_8( // CHECK: call void @__kmpc_for_static_fini( +void loop_with_It_plus(It begin, It end) { +#pragma omp for + for (It it = begin; it < end; it+=1) { + *it = 0; + } +} + +// CHECK-LABEL: loop_with_It_plus +// CHECK: call i32 @__kmpc_global_thread_num( +// CHECK: call void @__kmpc_for_static_init_8( +// CHECK: call void @__kmpc_for_static_fini( + void loop_with_stmt_expr() { #pragma omp for for (int i = __extension__({float b = 0;b; }); i < __extension__({double c = 1;c; }); i += __extension__({char d = 1; d; })) diff --git a/clang/test/OpenMP/for_loop_messages.cpp b/clang/test/OpenMP/for_loop_messages.cpp index bb58a77e5ade..01cc6020b85f 100644 --- a/clang/test/OpenMP/for_loop_messages.cpp +++ b/clang/test/OpenMP/for_loop_messages.cpp @@ -660,7 +660,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/for_simd_loop_messages.cpp b/clang/test/OpenMP/for_simd_loop_messages.cpp index e9729a8fc26d..ea17a836cf80 100644 --- a/clang/test/OpenMP/for_simd_loop_messages.cpp +++ b/clang/test/OpenMP/for_simd_loop_messages.cpp @@ -624,7 +624,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/parallel_for_loop_messages.cpp b/clang/test/OpenMP/parallel_for_loop_messages.cpp index 7e136e75869c..cf1f6195cc86 100644 --- a/clang/test/OpenMP/parallel_for_loop_messages.cpp +++ b/clang/test/OpenMP/parallel_for_loop_messages.cpp @@ -539,7 +539,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/parallel_for_simd_loop_messages.cpp b/clang/test/OpenMP/parallel_for_simd_loop_messages.cpp index 403e951d53c4..7feb4b0eb6ee 100644 --- a/clang/test/OpenMP/parallel_for_simd_loop_messages.cpp +++ b/clang/test/OpenMP/parallel_for_simd_loop_messages.cpp @@ -540,7 +540,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/simd_loop_messages.cpp b/clang/test/OpenMP/simd_loop_messages.cpp index 96b4cafc6bd8..a47ccbc87219 100644 --- a/clang/test/OpenMP/simd_loop_messages.cpp +++ b/clang/test/OpenMP/simd_loop_messages.cpp @@ -527,7 +527,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/target_parallel_for_loop_messages.cpp b/clang/test/OpenMP/target_parallel_for_loop_messages.cpp index 0e8eab10b5cb..d7c189116bf0 100644 --- a/clang/test/OpenMP/target_parallel_for_loop_messages.cpp +++ b/clang/test/OpenMP/target_parallel_for_loop_messages.cpp @@ -539,7 +539,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/target_parallel_for_simd_loop_messages.cpp b/clang/test/OpenMP/target_parallel_for_simd_loop_messages.cpp index c0dceeded454..ed184a5e4124 100644 --- a/clang/test/OpenMP/target_parallel_for_simd_loop_messages.cpp +++ b/clang/test/OpenMP/target_parallel_for_simd_loop_messages.cpp @@ -539,7 +539,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/target_simd_loop_messages.cpp b/clang/test/OpenMP/target_simd_loop_messages.cpp index 67201fb73fa7..d33f1f4cdc65 100644 --- a/clang/test/OpenMP/target_simd_loop_messages.cpp +++ b/clang/test/OpenMP/target_simd_loop_messages.cpp @@ -541,7 +541,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/target_teams_distribute_loop_messages.cpp b/clang/test/OpenMP/target_teams_distribute_loop_messages.cpp index cb243a66b1ae..441abcba0049 100644 --- a/clang/test/OpenMP/target_teams_distribute_loop_messages.cpp +++ b/clang/test/OpenMP/target_teams_distribute_loop_messages.cpp @@ -525,7 +525,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp index 83c78f2aac78..d912737a2146 100644 --- a/clang/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp +++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp @@ -523,7 +523,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp index a6b6dd817358..0ed57baa5c3b 100644 --- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp +++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp @@ -526,7 +526,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp b/clang/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp index 3ddabce5e8d7..aae00a4433bc 100644 --- a/clang/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp +++ b/clang/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp @@ -525,7 +525,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/taskloop_loop_messages.cpp b/clang/test/OpenMP/taskloop_loop_messages.cpp index 291cbdbe718c..edfc2a8dcde5 100644 --- a/clang/test/OpenMP/taskloop_loop_messages.cpp +++ b/clang/test/OpenMP/taskloop_loop_messages.cpp @@ -644,7 +644,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/taskloop_simd_loop_messages.cpp b/clang/test/OpenMP/taskloop_simd_loop_messages.cpp index 3326e6ff61cd..502224629a56 100644 --- a/clang/test/OpenMP/taskloop_simd_loop_messages.cpp +++ b/clang/test/OpenMP/taskloop_simd_loop_messages.cpp @@ -645,7 +645,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/teams_distribute_loop_messages.cpp b/clang/test/OpenMP/teams_distribute_loop_messages.cpp index dbfd9ef03cdb..ea2604eebf0f 100644 --- a/clang/test/OpenMP/teams_distribute_loop_messages.cpp +++ b/clang/test/OpenMP/teams_distribute_loop_messages.cpp @@ -607,7 +607,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_loop_messages.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_loop_messages.cpp index ea392fb93ed3..e0c315f513b7 100644 --- a/clang/test/OpenMP/teams_distribute_parallel_for_loop_messages.cpp +++ b/clang/test/OpenMP/teams_distribute_parallel_for_loop_messages.cpp @@ -605,7 +605,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp index 675ecb407f4d..03325623502f 100644 --- a/clang/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp +++ b/clang/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp @@ -607,7 +607,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { diff --git a/clang/test/OpenMP/teams_distribute_simd_loop_messages.cpp b/clang/test/OpenMP/teams_distribute_simd_loop_messages.cpp index 742bc7451e93..81fbfe860a70 100644 --- a/clang/test/OpenMP/teams_distribute_simd_loop_messages.cpp +++ b/clang/test/OpenMP/teams_distribute_simd_loop_messages.cpp @@ -607,7 +607,7 @@ void test_with_template() { t1.dotest_lt(begin, end); t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} - dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} + dotest_gt(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt' requested here}} } void test_loop_break() { -- cgit v1.2.3