public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: James Norris <jnorris@codesourcery.com>
To: Thomas Schwinge <thomas@codesourcery.com>
Cc: Tobias Burnus <burnus@net-b.de>, <gcc-patches@gcc.gnu.org>,
	<fortran@gcc.gnu.org>
Subject: Re: [gomp4] declare directive [3/5]
Date: Thu, 18 Jun 2015 16:02:00 -0000	[thread overview]
Message-ID: <5582EB95.5080106@codesourcery.com> (raw)
In-Reply-To: <87wpz2ejuc.fsf@kepler.schwinge.homeip.net>

[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]

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


[-- Attachment #2: declare.patch --]
[-- Type: text/x-patch, Size: 1013 bytes --]

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);
+	}
     }
 }
 

  reply	other threads:[~2015-06-18 16:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5575ADCB.6030107@codesourcery.com>
     [not found] ` <5575AEEB.6020902@codesourcery.com>
2015-06-17  9:59   ` Thomas Schwinge
2015-06-18 16:02     ` James Norris [this message]
2015-10-30 13:27   ` Thomas Schwinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5582EB95.5080106@codesourcery.com \
    --to=jnorris@codesourcery.com \
    --cc=burnus@net-b.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=thomas@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).