From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6F8EE3858D28; Thu, 25 Nov 2021 10:52:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F8EE3858D28 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:52:07 +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:52:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103416 --- Comment #3 from Tobias Burnus --- Okay, the map(to:D.4217 [len: 4][implicit]) map(tofrom:n [len: 4][implicit]) issue is not new =E2=80=93 only the '[implicit]' + the misaligned address o= ne (fixed by the patch from comment 1). * * * Thus regression =E2=86=92 comment 1 *** And extra map(to:D.4217) =E2=80=93 this occurs already with GCC 11 and is, = thus, not a regression. (Only '[implicit]' is new.) This seems to be due to a scope issue. In gimplify_omp_for (gdb) p debug(for_stmt) #pragma omp for nowait for (i0 =3D 1; i0 <=3D D.4217; i0 =3D i0 + 1) REALPART_EXPR =3D (real(kind=3D8)) n; which then calls at some point omp_notice_variable ( debug_tree(decl) which ends up with 7698 nflags |=3D GOVD_MAP | GOVD_MAP_TO_ONLY; The problem is that here integer(kind=3D4) D.3933; is generated in the parent scope of '#omp target' instead of in the parent scope of '#omp parallel do'. Thus, there are two questions: * Why is 'map(to:' and not 'firstprivate' used? * Why is the var generated in the parent scope of 'omp target' instead of inside 'omp target'?=