summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/for_codegen.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2017-08-31 23:06:52 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2017-08-31 23:06:52 +0000
commit5372fb8cc1abe6e6b1619beb8722b4596a61200e (patch)
tree34980dd1b825463a1554f9af1268efd43df30f5a /clang/test/OpenMP/for_codegen.cpp
parenta865658a74e03c0547f37a4bf9a46e13d9d1b97b (diff)
downloadbcm5719-llvm-5372fb8cc1abe6e6b1619beb8722b4596a61200e.tar.gz
bcm5719-llvm-5372fb8cc1abe6e6b1619beb8722b4596a61200e.zip
[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: 312292
Diffstat (limited to 'clang/test/OpenMP/for_codegen.cpp')
-rw-r--r--clang/test/OpenMP/for_codegen.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/OpenMP/for_codegen.cpp b/clang/test/OpenMP/for_codegen.cpp
index cb2b1637047..a50bcc9fc73 100644
--- a/clang/test/OpenMP/for_codegen.cpp
+++ b/clang/test/OpenMP/for_codegen.cpp
@@ -485,6 +485,18 @@ void loop_with_It(It<char> begin, It<char> end) {
// CHECK: call void @__kmpc_for_static_init_8(
// CHECK: call void @__kmpc_for_static_fini(
+void loop_with_It_plus(It<char> begin, It<char> end) {
+#pragma omp for
+ for (It<char> 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; }))
OpenPOWER on IntegriCloud