From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CCEE839450D4; Tue, 13 Apr 2021 13:16:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCEE839450D4 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/100059] [OpenMP] wrong code with 'declare target link' and a scalar variable Date: Tue, 13 Apr 2021 13:16:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: openmp, wrong-code 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: cc 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: Tue, 13 Apr 2021 13:16:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100059 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |vries at gcc dot gnu.org --- Comment #1 from Tobias Burnus --- For #pragma omp declare target link(a,c,b,i) the vars are walked in reverse order (=3D in normal order of 'offload_vars'= ): * In a.xnvptx-none.mkoffload.s: ------------ //:FUNC_MAP "main$_omp_fn$0" //:VAR_MAP "i$linkptr" // BEGIN GLOBAL VAR DEF: i$linkptr .visible .global .align 8 .u64 i$linkptr[1]; //:VAR_MAP "b$linkptr" // BEGIN GLOBAL VAR DEF: b$linkptr .visible .global .align 8 .u64 b$linkptr[1]; //:VAR_MAP "c$linkptr" // BEGIN GLOBAL VAR DEF: c$linkptr .visible .global .align 8 .u64 c$linkptr[1]; //:VAR_MAP "a$linkptr" // BEGIN GLOBAL VAR DEF: a$linkptr .visible .global .align 8 .u64 a$linkptr[1]; // BEGIN GLOBAL FUNCTION DECL: gomp_nvptx_main ------------ So far so good. However, after: nvptx-none/bin/as -m sm_35 -o ./a.xnvptx-none.mkoffload.o ./a.xnvptx-none.mkoffload.s the 'a.xnvptx-none.mkoffload.o' contains: ---------------- // BEGIN GLOBAL VAR DECL: __nvptx_uni .extern .shared .u32 __nvptx_uni[32]; //:VAR_MAP "b$linkptr" // BEGIN GLOBAL VAR DEF: b$linkptr .visible .global .align 8 .u64 b$linkptr[1]; //:FUNC_MAP "main$_omp_fn$0" //:VAR_MAP "i$linkptr" // BEGIN GLOBAL VAR DEF: i$linkptr .visible .global .align 8 .u64 i$linkptr[1]; //:VAR_MAP "c$linkptr" // BEGIN GLOBAL VAR DEF: c$linkptr .visible .global .align 8 .u64 c$linkptr[1]; //:VAR_MAP "a$linkptr" // BEGIN GLOBAL VAR DEF: a$linkptr .visible .global .align 8 .u64 a$linkptr[1]; // BEGIN GLOBAL FUNCTION DEF: update ---------------- Namely: 'b' and 'i' swapped the order! The problem seems to be the misplaced: //:FUNC_MAP "main$_omp_fn$0"=