This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp4] declare directive [3/5]


Hi Thomas!

On 06/17/2015 04:59 AM, Thomas Schwinge wrote:
Hi Jim!

I had mentioned that the Fortran front end changes cause regressions in a
few libgomp execution tests, if configured for Intel MIC (emulation)
offloading.  I have now located *where* this is coming from, but would
you please work on figuring out *why*?


There are actually two bugs in find_module_oacc_declare_clauses which
are causing the issues you are seeing.

With the first bug, if none of the 'oacc_declare_*' bits were asserted,
then the referenced field within the attribute structure was set to
zero. If the referenced field was already set to one prior to
find_module_oacc_declare_clauses being called, then the field gets
incorrectly set to zero, if none of the 'oacc_declare_*' bits were
asserted.

With the second bug, if the referenced field within the attribute
structure is already set to one prior to
find_module_oacc_declare_clauses being called, then the subroutine
add_clause was called. The subroutine add_clause should only be
called if one of the 'oacc_declare_*' bits are asserted.

The attached patch resolves the above issues.

Committed to gomp-4_0-branch

Jim

diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 77fdc8b..7387a80 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -5848,11 +5848,6 @@ find_module_oacc_declare_clauses (gfc_symbol *sym)
     {
       gfc_omp_map_op map_op;
 
-      sym->attr.referenced = sym->attr.oacc_declare_create
-			     | sym->attr.oacc_declare_copyin
-			     | sym->attr.oacc_declare_deviceptr
-			     | sym->attr.oacc_declare_device_resident;
-
       if (sym->attr.oacc_declare_create)
 	map_op = OMP_MAP_FORCE_ALLOC;
 
@@ -5865,8 +5860,14 @@ find_module_oacc_declare_clauses (gfc_symbol *sym)
       if (sym->attr.oacc_declare_device_resident)
 	map_op = OMP_MAP_DEVICE_RESIDENT;
 
-      if (sym->attr.referenced)
-	add_clause (sym, map_op);
+      if (sym->attr.oacc_declare_create
+	  || sym->attr.oacc_declare_copyin
+	  || sym->attr.oacc_declare_deviceptr
+	  || sym->attr.oacc_declare_device_resident)
+	{
+	  sym->attr.referenced = 1;
+	  add_clause (sym, map_op);
+	}
     }
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]