Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <tstellar@redhat.com>2017-11-14 03:00:35 +0300
committerTom Stellard <tstellar@redhat.com>2017-11-14 03:00:35 +0300
commit9347003bd97c4c228147ae1bfca3c5e90d4621b9 (patch)
treeb6e823fd5fd200a7ed89076d5c9b9efa73b91456
parent8a6a32d37a81ef88d7cd4d349a8c1f5e1ad0b6ef (diff)
Merging r315586:
------------------------------------------------------------------------ r315586 | abataev | 2017-10-12 08:18:41 -0700 (Thu, 12 Oct 2017) | 5 lines [OPENMP] Fix PR34926: Fix handling of the array sections passed as function params. Codegen could crash if the array section base expression is the function parameter. ------------------------------------------------------------------------ llvm-svn: 318118
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp7
-rw-r--r--clang/test/OpenMP/parallel_reduction_codegen.cpp8
2 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index bc37c9e636c3..63c7b3d10bf9 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -3309,12 +3309,7 @@ static Address emitOMPArraySectionBase(CodeGenFunction &CGF, const Expr *Base,
LValue CodeGenFunction::EmitOMPArraySectionExpr(const OMPArraySectionExpr *E,
bool IsLowerBound) {
- QualType BaseTy;
- if (auto *ASE =
- dyn_cast<OMPArraySectionExpr>(E->getBase()->IgnoreParenImpCasts()))
- BaseTy = OMPArraySectionExpr::getBaseOriginalType(ASE);
- else
- BaseTy = E->getBase()->getType();
+ QualType BaseTy = OMPArraySectionExpr::getBaseOriginalType(E->getBase());
QualType ResultExprTy;
if (auto *AT = getContext().getAsArrayType(BaseTy))
ResultExprTy = AT->getElementType();
diff --git a/clang/test/OpenMP/parallel_reduction_codegen.cpp b/clang/test/OpenMP/parallel_reduction_codegen.cpp
index e42776c740b5..c4c0ff473a59 100644
--- a/clang/test/OpenMP/parallel_reduction_codegen.cpp
+++ b/clang/test/OpenMP/parallel_reduction_codegen.cpp
@@ -80,6 +80,14 @@ struct SST {
// CHECK-DAG: [[REDUCTION_LOC:@.+]] = private unnamed_addr constant %{{.+}} { i32 0, i32 18, i32 0, i32 0, i8*
// CHECK-DAG: [[REDUCTION_LOCK:@.+]] = common global [8 x i32] zeroinitializer
+//CHECK: foo_array_sect
+//CHECK: call void {{.+}}@__kmpc_fork_call(
+//CHECK: ret void
+void foo_array_sect(short x[1]) {
+#pragma omp parallel reduction(+ : x[:])
+ {}
+}
+
template <typename T>
T tmain() {
T t;