From: Jason Merrill <jason@redhat.com>
To: Julian Brown <julian@codesourcery.com>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>,
"Joseph S. Myers" <joseph@codesourcery.com>,
Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH, OpenACC] Support C++ "this" in OpenACC directives (PR66053)
Date: Thu, 30 Aug 2018 20:27:00 -0000 [thread overview]
Message-ID: <CADzB+2mROw6cjkMnynKisLOucdH8pnzT_cgoGDovAyKR2Wvogw@mail.gmail.com> (raw)
In-Reply-To: <20180830153134.544d4bef@squid.athome>
On Thu, Aug 30, 2018 at 3:31 PM, Julian Brown <julian@codesourcery.com> wrote:
> This patch (by Joseph) allows "this" to be used in OpenACC directives,
> following -- IIUC -- the behaviour of other compilers. The standard (as
> of OpenACC 2.5) does not appear to have explicit language either
> permitting or forbidding such usage.
>
> Joseph's original commentary is in the bug report (ca. 2015,
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66053):
>
> "This patch, for gomp-4_0-branch, adds support for C++ "this" in
> OpenACC directives. (This patch does not do anything to handle OpenMP
> differently from OpenACC; that - bug 66053 - will need to be resolved
> for mainline, either deciding these cases should be accepted for
> OpenMP or making the parsing only accept them in OpenACC directives
> and not OpenMP ones.)
>
> "Apart from parsing, it's necessary to prevent the "cannot take the
> address of 'this', which is an rvalue expression" error from appearing
> when "this" is used in such contexts. This patch duly adds a new
> argument to cxx_mark_addressable (default false so callers don't all
> need to change) to allow disabling that error, passing that argument
> in all calls that seem relevant to OpenACC directives."
>
> AFAICT though, this attached version of the patch does still forbid
> "this" in OpenMP directives (apart from "declare simd"). I couldn't see
> that there was any change to the OpenMP spec language in 4.5.
>
> Tested with offloading to NVPTX and bootstrapped.
>
> OK to apply?
>
> Julian
>
> ChangeLog
>
> 20xx-xx-xx Joseph Myers <joseph@codesourcery.com>
>
> PR C++/66053
>
> gcc/cp/
> * cp-tree.h (enum cxx_mark_addressable_flags): New.
> (cxx_mark_addressable): Use it. Adjust users.
> * parser.c (cp_parser_omp_var_list_no_open): Handle RID_THIS.
> * semantics.c (handle_omp_array_sections_1)
> (handle_omp_array_sections, finish_omp_reduction_clause)
> (finish_omp_clauses): Pass CXX_MARK_ADDRESSABLE_FLAGS_ALLOW_THIS
> to cxx_mark_addressable. Enforce "this" usage limitation only
> for OpenMP.
> * typeck.c (cp_build_array_ref): Adjust cxx_mark_addressble
> call. (cxx_mark_addressable): Handle
> CXX_MARK_ADDRESSABLE_FLAGS_ALLOW_THIS.
>
> libgomp/
> * testsuite/libgomp.oacc-c++/this.C: New test.
Why does referring to this[0:1] require making 'this' addressable?
Surely what we're interested in is the value of 'this', not the
address.
Jason
next prev parent reply other threads:[~2018-08-30 20:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-30 19:32 Julian Brown
2018-08-30 20:27 ` Jason Merrill [this message]
2018-08-31 14:04 ` Nathan Sidwell
2018-08-31 14:20 ` Jakub Jelinek
2018-09-03 23:50 ` Julian Brown
2018-10-25 20:08 ` Jason Merrill
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=CADzB+2mROw6cjkMnynKisLOucdH8pnzT_cgoGDovAyKR2Wvogw@mail.gmail.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.com \
--cc=julian@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).