From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3E65E3858C27; Thu, 25 Nov 2021 10:07:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E65E3858C27 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/103416] [12 Regression][OpenMP] Bogus firstprivate(n) map(to:n [len: 4][implicit]) Date: Thu, 25 Nov 2021 10:07:00 +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: 12.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: 12.0 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: Thu, 25 Nov 2021 10:07:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103416 --- Comment #2 from Tobias Burnus --- (In reply to Chung-Lin Tang from comment #1) > Can you see if adding this patch: > https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583279.html > fixes this problem? If so, then it should be another occurrence of PR90030 Yes and no. That patch FIXES the issue libgomp: cuCtxSynchronize error: misaligned address libgomp: cuMemFree_v2 error: misaligned address libgomp: device finalization failed BUT I still see #pragma omp target map(to:D.4246 [len: 4][implicit]) ... and when adding an explicit firstprivate(n) I see #pragma omp target firstprivate(n) map(to:D.4246 [len: 4][implicit]) ... which looks wrong. I understand that implicit mapping tries to solve the problem of explicitly mapping an array section via 'omp target (enter) data= ' - and then implicitly mapping the whole array. =E2=80=94 But I think it does = not make sense to add this implicit mapping if there is an implicit or explicit 'firstprivate' for that variable. =E2=80=93 That's just generates pointless= code, obfuscates the dump, adds an overhead to libgomp, ... Actually, it does not only apply to 'firstprivate' - the same also can be caused for 'tofrom' vs. 'to' as in #pragma omp target ... map(to:D.4217 [len: 4][implicit]) map(tofrom:n [len: 4][implicit]) for the following code: PROGRAM target_parallel_do implicit none INTEGER :: i0, N COMPLEX(8) :: scalar N =3D 1 !$OMP TARGET PARALLEL do map(from: scalar) private(i0) defaultmap(tofrom) DO i0 =3D 1, N scalar%re =3D n END DO !$omp end target parallel do END PROGRAM target_parallel_do Admittedly, I have not yet managed to construct something which causes an observable misbehavior.=