public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tobias.weinzierl at durham dot ac.uk" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/96835] Constructor in offload template class Date: Mon, 05 Oct 2020 16:12:48 +0000 [thread overview] Message-ID: <bug-96835-4-Ekw6lDZpsc@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-96835-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96835 --- Comment #2 from Tobias Weinzierl <tobias.weinzierl at durham dot ac.uk> --- #include <stdio.h> #pragma omp declare target template<int sz> struct vector { int values_[sz]; vector(); vector(int const& init_val); int dot(vector o) { int res = 0; for (int i = 0; i < sz; ++ i) res += values_[i] * o.values_[i]; return res; } }; template<int sz> vector<sz>::vector(int const& init_val) { for (int i = 0; i < sz; ++ i) values_[i] = init_val; } template<int sz> vector<sz>::vector() : vector(0) { } #pragma omp end declare target int main() { int res; #pragma omp target map(from:res) { vector<4> v1(1); vector<4> v2(2); res = v1.dot(v2); } printf("%d\n", res); return 0; }
next prev parent reply other threads:[~2020-10-05 16:12 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-28 9:40 [Bug target/96835] New: " tobias.weinzierl at durham dot ac.uk 2020-08-28 16:07 ` [Bug target/96835] " jakub at gcc dot gnu.org 2020-10-05 16:12 ` tobias.weinzierl at durham dot ac.uk [this message] 2020-10-05 16:14 ` tobias.weinzierl at durham dot ac.uk 2020-10-09 10:52 ` tobias.weinzierl at durham dot ac.uk 2020-11-09 12:02 ` redi at gcc dot gnu.org 2020-11-09 13:24 ` burnus at gcc dot gnu.org 2020-11-17 17:33 ` tobias.weinzierl at durham dot ac.uk 2020-11-17 17:35 ` tobias.weinzierl at durham dot ac.uk
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-96835-4-Ekw6lDZpsc@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: linkBe 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).