[llvm-branch-commits] [cfe-branch] r286972 - Merging r283223:

Alexey Bataev via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Nov 15 06:44:21 PST 2016


Author: abataev
Date: Tue Nov 15 08:44:21 2016
New Revision: 286972

URL: http://llvm.org/viewvc/llvm-project?rev=286972&view=rev
Log:
Merging r283223:
r283223 | davidsh | 2016-10-04 10:41:36 -0400 (Tue, 04 Oct 2016) | 1 line

[OpenMP] fix segfault when a variable referenced in reduction clause is a reference parameter
Differential Revision: http://reviews.llvm.org/D24524

Modified:
    cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp
    cfe/branches/release_39/test/OpenMP/distribute_parallel_for_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/distribute_simd_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/for_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/for_simd_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/parallel_for_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/parallel_for_simd_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/parallel_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/parallel_sections_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/sections_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/simd_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/target_parallel_for_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/target_parallel_reduction_messages.cpp
    cfe/branches/release_39/test/OpenMP/teams_reduction_messages.cpp

Modified: cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp Tue Nov 15 08:44:21 2016
@@ -9133,7 +9133,7 @@ OMPClause *Sema::ActOnOpenMPReductionCla
     //  for all threads of the team.
     if (!ASE && !OASE && VD) {
       VarDecl *VDDef = VD->getDefinition();
-      if (VD->getType()->isReferenceType() && VDDef) {
+      if (VD->getType()->isReferenceType() && VDDef && VDDef->hasInit()) {
         DSARefChecker Check(DSAStack);
         if (Check.Visit(VDDef->getInit())) {
           Diag(ELoc, diag::err_omp_reduction_ref_type_arg) << ERange;

Modified: cfe/branches/release_39/test/OpenMP/distribute_parallel_for_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/distribute_parallel_for_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/distribute_parallel_for_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/distribute_parallel_for_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,14 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp target
+#pragma omp teams
+#pragma omp distribute parallel for reduction(+:ref)
+  for (int i = 0; i < 10; ++i)
+    foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,14 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp target
+#pragma omp teams
+#pragma omp distribute parallel for simd reduction(+:ref)
+  for (int i = 0; i < 10; ++i)
+    foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/distribute_simd_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/distribute_simd_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/distribute_simd_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/distribute_simd_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,14 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp target
+#pragma omp teams
+#pragma omp distribute simd reduction(+:ref)
+  for (int i = 0; i < 10; ++i)
+    foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/for_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/for_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/for_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/for_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp parallel
+#pragma omp for reduction(+:ref)
+  for (int i = 0; i < 10; ++i)
+    foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/for_simd_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/for_simd_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/for_simd_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/for_simd_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp parallel
+#pragma omp for simd reduction(+:ref)
+  for (int i = 0; i < 10; ++i)
+    foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/parallel_for_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/parallel_for_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/parallel_for_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/parallel_for_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,12 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp parallel for reduction(+:ref)
+  for (int i = 0; i < 10; ++i)
+    foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/parallel_for_simd_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/parallel_for_simd_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/parallel_for_simd_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/parallel_for_simd_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,12 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp parallel for simd reduction(+:ref)
+  for (int i = 0; i < 10; ++i)
+    foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/parallel_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/parallel_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/parallel_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/parallel_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,11 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp parallel reduction(+:ref)
+  foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/parallel_sections_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/parallel_sections_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/parallel_sections_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/parallel_sections_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp parallel sections reduction(+:ref)
+  {
+    foo();
+  }
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/sections_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/sections_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/sections_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/sections_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,14 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp parallel   
+#pragma omp sections reduction(+:ref)
+  {
+    foo();
+  }
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/simd_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/simd_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/simd_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/simd_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,12 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp simd reduction(+:ref)
+  for (int i = 0; i < 10; ++i)
+    foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/target_parallel_for_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/target_parallel_for_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/target_parallel_for_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/target_parallel_for_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,12 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp target parallel for reduction(+:ref)
+  for (int i = 0; i < 10; ++i)
+    foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,12 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp target parallel for simd reduction(+:ref)
+  for (int i = 0; i < 10; ++i)
+    foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/target_parallel_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/target_parallel_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/target_parallel_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/target_parallel_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,11 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp target parallel reduction(+:ref)
+  foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {

Modified: cfe/branches/release_39/test/OpenMP/teams_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/teams_reduction_messages.cpp?rev=286972&r1=286971&r2=286972&view=diff
==============================================================================
--- cfe/branches/release_39/test/OpenMP/teams_reduction_messages.cpp (original)
+++ cfe/branches/release_39/test/OpenMP/teams_reduction_messages.cpp Tue Nov 15 08:44:21 2016
@@ -9,6 +9,12 @@ bool foobool(int argc) {
   return argc;
 }
 
+void foobar(int &ref) {
+#pragma omp target
+#pragma omp teams reduction(+:ref)
+  foo();
+}
+
 struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {




More information about the llvm-branch-commits mailing list