diff mbox

[gomp4] remove c++ reference restriction

Message ID 878u6319km.fsf@schwinge.name
State New
Headers show

Commit Message

Thomas Schwinge Nov. 12, 2015, 4:11 p.m. UTC
Hi Nathan!

On Thu, 12 Nov 2015 09:03:42 -0500, Nathan Sidwell <nathan@acm.org> wrote:
> I've applied this to gomp4 branch.  It removes the machinery concerning c++ 
> references.  The openacc std makes no  mention of such a type, so originally we 
> were not permitting the type. But,
> (a) OpenMP supports them, which suggests openacc wishes to
> (b) Fortran already has reference types that need supporting
> (c) it's more work to not support them, by modifying the mappable_type hook.

ACK.  "For reference", your and Cesar's original reasoning had been that
the OpenACC 2.0a specification doesn't talk about reference types
specifically, and they're non-POD, so not supported, which lead to
Cesar's patch that I applied to gomp-4_0-branch in r223179,
<http://news.gmane.org/find-root.php?message_id=%3C87sib0jivr.fsf%40schwinge.name%3E>.
Now, if they "just work", that's even better of course.

> 2015-11-12  Nathan Sidwell  <nathan@codesourcery.com>

That was incomplete however, so we got a testsuite regression because of:

    [...]/gcc/testsuite/g++.dg/goacc/reference.C: In function 'int test1(int&)':
    [...]/gcc/testsuite/g++.dg/goacc/reference.C:7:27: error: reference types are not supported in OpenACC
    [...]/gcc/testsuite/g++.dg/goacc/reference.C: In function 'int main()':
    [...]/gcc/testsuite/g++.dg/goacc/reference.C:36:33: error: reference types are not supported in OpenACC

Fixed on gomp-4_0-branch in r230265:

commit 6ec26341420b3ced11af5adbe4643ff6cfaf99eb
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Nov 12 16:09:47 2015 +0000

    Complete reversion of "Prohibit C++ reference types in OpenACC regions"
    
    	gcc/cp/
    	* semantics.c (finish_omp_clauses): Remove "reference types are
    	not supported in OpenACC" diagnostic.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@230265 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/cp/ChangeLog.gomp | 5 +++++
 gcc/cp/semantics.c    | 9 ++-------
 2 files changed, 7 insertions(+), 7 deletions(-)



Grüße
 Thomas
diff mbox

Patch

diff --git gcc/cp/ChangeLog.gomp gcc/cp/ChangeLog.gomp
index 1f19b39..e4d000d 100644
--- gcc/cp/ChangeLog.gomp
+++ gcc/cp/ChangeLog.gomp
@@ -1,3 +1,8 @@ 
+2015-11-12  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* semantics.c (finish_omp_clauses): Remove "reference types are
+	not supported in OpenACC" diagnostic.
+
 2015-11-12  Nathan Sidwell  <nathan@codesourcery.com>
 
 	* semantics.c (finish_ommp_clauses): Adjust omp_mappable_type calls.
diff --git gcc/cp/semantics.c gcc/cp/semantics.c
index 34ccec6..ac3cb66 100644
--- gcc/cp/semantics.c
+++ gcc/cp/semantics.c
@@ -6552,11 +6552,6 @@  finish_omp_clauses (tree clauses, bool is_oacc, bool allow_fields,
 		}
 	      break;
 	    }
-	  if (is_oacc && TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
-	    {
-	      error_at (OMP_CLAUSE_LOCATION (c),
-			"reference types are not supported in OpenACC");
-	    }
 	  if (t == error_mark_node)
 	    {
 	      remove = true;
@@ -6648,10 +6643,10 @@  finish_omp_clauses (tree clauses, bool is_oacc, bool allow_fields,
 			     == GOMP_MAP_FIRSTPRIVATE_POINTER)))
 		   && t == OMP_CLAUSE_DECL (c)
 		   && !type_dependent_expression_p (t)
-		   && !cp_omp_mappable_type (((TREE_CODE (TREE_TYPE (t))
+		   && !cp_omp_mappable_type ((TREE_CODE (TREE_TYPE (t))
 					      == REFERENCE_TYPE)
 					     ? TREE_TYPE (TREE_TYPE (t))
-					     : TREE_TYPE (t))))
+					     : TREE_TYPE (t)))
 	    {
 	      error_at (OMP_CLAUSE_LOCATION (c),
 			"%qD does not have a mappable type in %qs clause", t,