From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AB3C13858D28; Sat, 26 Feb 2022 00:06:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB3C13858D28 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/104696] New: [12 Regression][OpenMP] Implicit mapping breaks struct mapping Date: Sat, 26 Feb 2022 00:06:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran 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: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: 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: Sat, 26 Feb 2022 00:06:24 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104696 Bug ID: 104696 Summary: [12 Regression][OpenMP] Implicit mapping breaks struct mapping Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: openmp, wrong-code Severity: normal Priority: P3 Component: fortran 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: --- Created attachment 52519 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52519&action=3Dedit implicit.f90 - compile with -fopenmp and run with a non-shared-memory devic= e. In my understanding, the following is valid and should work. However, it fails =E2=80=93 and I bet it is due to the implicit mapping of = 'var3'. The code uses: !$omp target map(to: var3%R(2)%d) ... Printing on the host the 'loc (var3%R(2)%d)' shows: 21516C0 7F51E5E001D8 STOP 11 As var%R(2)%d (or in the dump 'var3.r[1].d.data') is now in device address space, accessing it after the target region crashes the program. implicit.f90.005t.original: #pragma omp target map(to:var3.r[1].d [len: 88]) map(to:*(struct t2[0:] *) var3.r[1].d.data [len: D.4243 * 4]) map(always_pointer:(struct t2[0:] *) var3.r[1].d.data [pointer assign, bias: 0]) implicit.f90.006t.gimple: #pragma omp target num_teams(1) thread_limit(0) map(tofrom:var3 [len: 440][implicit]) map(to:var3.r[1].d [len: 88]) map(to:MEM [(struct t2[0:] *)_9] [len: _8]) map(always_pointer:var3.r[1].d.data [pointer assign, bias: 0])=