From: Julian Brown <julian@codesourcery.com>
To: Iain Sandoe <idsandoe@googlemail.com>
Cc: Jakub Jelinek <jakub@redhat.com>, Martin Jambor <mjambor@suse.cz>,
"Cesar Philippidis" <cesar@codesourcery.com>,
"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Thomas Schwinge <thomas@codesourcery.com>
Subject: Re: [patch,openacc] Fix PR71959: lto dump of callee counts
Date: Tue, 08 Jan 2019 13:31:00 -0000 [thread overview]
Message-ID: <20190108133045.6a576f2c@squid.athome> (raw)
In-Reply-To: <844297BE-45C7-4CF9-BB5E-C77E9B5B9EBB@googlemail.com>
[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]
On Sat, 22 Dec 2018 15:09:34 +0000
Iain Sandoe <idsandoe@googlemail.com> wrote:
> Hi Julian,
>
> > On 21 Dec 2018, at 16:47, Julian Brown <julian@codesourcery.com>
> > wrote:
>
> > On Fri, 21 Dec 2018 14:31:19 +0100
> > Jakub Jelinek <jakub@redhat.com> wrote:
> >
> >> On Fri, Dec 21, 2018 at 01:23:03PM +0000, Julian Brown wrote:
> >>> 2018-xx-yy Nathan Sidwell <nathan@acm.org>
> >
>
> >>> * testsuite/libgomp.oacc-c++/pr71959-a.C: New.
> >>> * testsuite/libgomp.oacc-c++/pr71959.C: New.
> >>
> >>> +void apply (int (*fn)(), Iter out) asm
> >>> ("_ZN5Apply5applyEPFivE4Iter");
> >>
> >> Will this work even on targets that use _ or other symbol
> >> prefixes?
> >
> > I'd guess so, else there would be no portable way of using "asm" to
> > write pre-mangled C++ names. The only existing similar uses I could
> > find in the testsuite are for the ifunc attribute, not asm, though
> > (e.g. g++.dg/ext/attr-ifunc-*.C).
>
> It won’t work on such targets (e.g. Darwin)
> … but it’s not too hard to make it happen (see, for example,
> gcc.dg/memcmp-1.c)
>
> One just has to remember that __USER_LABEL_PREFIX__ is a token, not a
> string.
>
> so .. in the example above…
>
> #define STR1(X) #X
> #define STR2(X) STR1(X)
>
> ….
>
> asm(STR2(__USER_LABEL_PREFIX__) "_ZN5Apply5applyEPFivE4Iter”);
Thanks! I've amended the test to use this technique (though I can't
easily test on Darwin, so this is "best effort").
> > Anyway, OpenACC is only useful for a handful of targets at present,
> > neither of which use special symbol prefixes AFAIK.
>
> I have hopes of one day getting offloading to work on Darwin (the
> only limitation is developer time, not technical feasibility) ..
Is this OK now (for stage 4)?
Thanks,
Julian
[-- Attachment #2: pr71959-test-only-3.diff --]
[-- Type: text/x-patch, Size: 1967 bytes --]
commit 2ee3f8d09a7b2af6c9ba29cdd8e8587db1946c0b
Author: Julian Brown <julian@codesourcery.com>
Date: Wed Dec 19 05:01:58 2018 -0800
Add testcase from PR71959
libgomp/
PR lto/71959
* testsuite/libgomp.oacc-c++/pr71959-aux.cc: New.
* testsuite/libgomp.oacc-c++/pr71959.C: New.
diff --git a/libgomp/testsuite/libgomp.oacc-c++/pr71959-aux.cc b/libgomp/testsuite/libgomp.oacc-c++/pr71959-aux.cc
new file mode 100644
index 0000000..10a6eeb
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c++/pr71959-aux.cc
@@ -0,0 +1,35 @@
+// { dg-do compile }
+
+#define STR1(X) #X
+#define STR2(X) STR1(X)
+#define LABEL(X) STR2(__USER_LABEL_PREFIX__) X
+
+struct Iter
+{
+ int *cursor;
+
+ void ctor (int *cursor_) asm (LABEL ("_ZN4IterC1EPi"));
+ int *point () const asm (LABEL ("_ZNK4Iter5pointEv"));
+};
+
+#pragma acc routine
+void Iter::ctor (int *cursor_)
+{
+ cursor = cursor_;
+}
+
+#pragma acc routine
+int *Iter::point () const
+{
+ return cursor;
+}
+
+void apply (int (*fn)(), Iter out) asm (LABEL ("_ZN5Apply5applyEPFivE4Iter"));
+
+#pragma acc routine
+void apply (int (*fn)(), struct Iter out)
+{ *out.point() = fn (); }
+
+extern "C" void __gxx_personality_v0 ()
+{
+}
diff --git a/libgomp/testsuite/libgomp.oacc-c++/pr71959.C b/libgomp/testsuite/libgomp.oacc-c++/pr71959.C
new file mode 100644
index 0000000..bf27a75
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c++/pr71959.C
@@ -0,0 +1,31 @@
+// { dg-additional-sources "pr71959-aux.cc" }
+
+// PR lto/71959 ICEd LTO due to mismatch between writing & reading behaviour
+
+struct Iter
+{
+ int *cursor;
+
+ Iter(int *cursor_) : cursor(cursor_) {}
+
+ int *point() const { return cursor; }
+};
+
+#pragma acc routine seq
+int one () { return 1; }
+
+struct Apply
+{
+ static void apply (int (*fn)(), Iter out)
+ { *out.point() = fn (); }
+};
+
+int main ()
+{
+ int x;
+
+#pragma acc parallel copyout(x)
+ Apply::apply (one, Iter (&x));
+
+ return x != 1;
+}
next prev parent reply other threads:[~2019-01-08 13:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 18:06 Cesar Philippidis
2018-09-25 13:01 ` Martin Jambor
2018-12-21 3:45 ` Julian Brown
2018-12-21 13:29 ` Julian Brown
2018-12-21 13:32 ` Jakub Jelinek
2018-12-21 17:09 ` Julian Brown
2018-12-22 18:53 ` Iain Sandoe
2019-01-08 13:31 ` Julian Brown [this message]
2019-01-08 13:36 ` Jakub Jelinek
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=20190108133045.6a576f2c@squid.athome \
--to=julian@codesourcery.com \
--cc=cesar@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=idsandoe@googlemail.com \
--cc=jakub@redhat.com \
--cc=mjambor@suse.cz \
--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).