From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A44EA384A40A; Wed, 10 Mar 2021 10:15:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A44EA384A40A From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyBjKysvOTk1MDldIFtPcGVuTVBdICdvbXAgZGVjbGFyZSB0?= =?UTF-8?B?YXJnZXQnIGZvciBnbG9iYWwgdmFyaWFibGUg4oaSICJoYXNuJ3QgYmVlbiBt?= =?UTF-8?B?YXJrZWQgdG8gYmUgaW5jbHVkZWQgaW4gdGhlIG9mZmxvYWRlZCBjb2RlIg==?= Date: Wed, 10 Mar 2021 10:15:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: openmp, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 10:15:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99509 --- Comment #1 from Tobias Burnus --- Variant which also is valid C: #pragma omp declare target int data[]=3D{5}; #pragma omp end declare target inline int foo(int idx) { return data[idx]; } int main() { int i; #pragma omp target map(to:i) i =3D foo(0); return i; } Result as follows; enclosing the 'foo' in the declare-target block has no effect. With g++ this still fails with: bar2.cc:2:7: error: variable 'data' has been referenced in offloaded code b= ut hasn't been marked to be included in the offloaded code 2 | int data[]=3D{5}; | ^ lto1: fatal error: errors during merging of translation units But with cc it fails with: unresolved symbol foo mkoffload: fatal error: ...=