public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99509] New: [OpenMP] 'omp declare target' for global variable → "hasn't been marked to be included in the offloaded code"
@ 2021-03-10  8:45 burnus at gcc dot gnu.org
  2021-03-10 10:15 ` [Bug c++/99509] " burnus at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-03-10  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99509
           Summary: [OpenMP] 'omp declare target' for global variable →
                    "hasn't been marked to be included in the offloaded
                    code"
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: openmp, rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: cltang at gcc dot gnu.org, jakub at gcc dot gnu.org
  Target Milestone: ---

The following code fails when compiled for offloading with:

foo3.cc:2:7: error: variable 'data' has been referenced in offloaded code but
hasn't been marked to be included in the offloaded code
    2 |  int data[]={5};
      |      ^
lto1: fatal error: errors during merging of translation units



#pragma omp declare target
  int data[]={5};
#pragma omp end declare target

struct my { inline const int& operator[](const int idx) const { return
data[idx]; } };

int main()
{
  int i;
  struct my cs;
  #pragma omp target map(to:i)
    i = cs[0];
  return i;
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-15 10:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10  8:45 [Bug c++/99509] New: [OpenMP] 'omp declare target' for global variable → "hasn't been marked to be included in the offloaded code" burnus at gcc dot gnu.org
2021-03-10 10:15 ` [Bug c++/99509] " burnus at gcc dot gnu.org
2021-03-10 11:37 ` jakub at gcc dot gnu.org
2021-03-10 15:08 ` burnus at gcc dot gnu.org
2021-03-15  9:13 ` cvs-commit at gcc dot gnu.org
2021-03-15 10:31 ` burnus at gcc dot gnu.org

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).