public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/104696] [OpenMP] component/array-ref/component (x.r[1].d) should use 'x' for GOMP_MAP_STRUCT (not yield 'x.r[1]' for nonptr 'x.r')
Date: Mon, 14 Mar 2022 14:48:17 +0000	[thread overview]
Message-ID: <bug-104696-4-cFYR3Aupf1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104696-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104696

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |middle-end
            Summary|[OpenMP] Implicit mapping   |[OpenMP]
                   |breaks struct mapping       |component/array-ref/compone
                   |                            |nt (x.r[1].d) should use
                   |                            |'x' for GOMP_MAP_STRUCT
                   |                            |(not yield 'x.r[1]' for
                   |                            |nonptr 'x.r')

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #4)
>   #pragma omp target map(tofrom: x.r[1].d)
>    *.r[1].d = 3;

s/*/x/

The problem is that in gimplify.cc's gimplify_scan_omp_clauses:

                  tree base
                    = extract_base_bit_offset (OMP_CLAUSE_DECL (c), &base_ref,
                                               &bitpos1, &offset1,
                                               &tree_offset1);
                  bool do_map_struct = (base == decl && !tree_offset1);

Here, 'base' == 'x' but 'decl' is 'x.r[1]' - while for 'x.q.d' it is 'x' (==
base).

The comp refs are removed as follows. (It seems as if some additional ARRAY_REF
checking is needed for non-pointer components.)

              else if (TREE_CODE (decl) == COMPONENT_REF
                       && (OMP_CLAUSE_MAP_KIND (c)
                           != GOMP_MAP_ATTACH_ZERO_LENGTH_ARRAY_SECTION))
                { 
                  component_ref_p = true; 
                  while (TREE_CODE (decl) == COMPONENT_REF)
                    decl = TREE_OPERAND (decl, 0);
                  if (TREE_CODE (decl) == INDIRECT_REF
                      && DECL_P (TREE_OPERAND (decl, 0))
                      && (TREE_CODE (TREE_TYPE (TREE_OPERAND (decl, 0)))
                          == REFERENCE_TYPE))
                    decl = TREE_OPERAND (decl, 0);
                }

Probably the same for '!DECL_P (decl)' in the previous 'if' branch.

  parent reply	other threads:[~2022-03-14 14:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-26  0:06 [Bug fortran/104696] New: [12 Regression][OpenMP] Implicit mapping breaks struct mapping burnus at gcc dot gnu.org
2022-03-01  7:35 ` [Bug fortran/104696] " rguenth at gcc dot gnu.org
2022-03-03 17:18 ` [Bug fortran/104696] [OpenMP] " burnus at gcc dot gnu.org
2022-03-07 13:53 ` burnus at gcc dot gnu.org
2022-03-10 14:27 ` cltang at gcc dot gnu.org
2022-03-10 15:13 ` burnus at gcc dot gnu.org
2022-03-14 14:48 ` burnus at gcc dot gnu.org [this message]
2022-05-06  8:32 ` [Bug middle-end/104696] [OpenMP] component/array-ref/component (x.r[1].d) should use 'x' for GOMP_MAP_STRUCT (not yield 'x.r[1]' for nonptr 'x.r') jakub at gcc dot gnu.org
2023-05-08 12:23 ` rguenth at gcc dot gnu.org

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=bug-104696-4-cFYR3Aupf1@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).