[llvm-branch-commits] [cfe-branch] r318118 - Merging r315586:

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 13 16:00:35 PST 2017


Author: tstellar
Date: Mon Nov 13 16:00:35 2017
New Revision: 318118

URL: http://llvm.org/viewvc/llvm-project?rev=318118&view=rev
Log:
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.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_50/lib/CodeGen/CGExpr.cpp
    cfe/branches/release_50/test/OpenMP/parallel_reduction_codegen.cpp

Modified: cfe/branches/release_50/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/lib/CodeGen/CGExpr.cpp?rev=318118&r1=318117&r2=318118&view=diff
==============================================================================
--- cfe/branches/release_50/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/branches/release_50/lib/CodeGen/CGExpr.cpp Mon Nov 13 16:00:35 2017
@@ -3309,12 +3309,7 @@ static Address emitOMPArraySectionBase(C
 
 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();

Modified: cfe/branches/release_50/test/OpenMP/parallel_reduction_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_50/test/OpenMP/parallel_reduction_codegen.cpp?rev=318118&r1=318117&r2=318118&view=diff
==============================================================================
--- cfe/branches/release_50/test/OpenMP/parallel_reduction_codegen.cpp (original)
+++ cfe/branches/release_50/test/OpenMP/parallel_reduction_codegen.cpp Mon Nov 13 16:00:35 2017
@@ -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;




More information about the llvm-branch-commits mailing list