From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A4EF43851C39; Tue, 18 Aug 2020 06:56:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4EF43851C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1597733814; bh=WZcO5UNnAKC5tHUXvyh6S4KO3FcTfaOkpK381aB63WE=; h=From:To:Subject:Date:From; b=jG7wmJjZ+TxdEyhjXcBDn3HmwHrBEgnXjGJWFHhUbKwBvBdNqN0a+Gkhtv7QyjcwZ NzKc4JBr09tBN1YSAfFHEptiqn6TBuKgOReP3U+OHC5L4vF4TgG+9l0o/EY010scSW zhb7ZsHilr3CLzk9hgJqt3PbRl7QrMZX7e6/zOW4= From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/96668] New: [OpenMP] Re-mapping allocated but previously unallocated allocatable does not work Date: Tue, 18 Aug 2020 06:56:54 +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: 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc target_milestone 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: Tue, 18 Aug 2020 06:56:54 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96668 Bug ID: 96668 Summary: [OpenMP] Re-mapping allocated but previously unallocated allocatable does not work Product: gcc Version: 11.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: jakub at gcc dot gnu.org Target Milestone: --- The exact behaviour is not well specified in OpenMP 4.5 or 5.0 but at least with 'always' the following is expected to map. (See OpenMP Issue 2152 + upcoming OpenMP TR9 =E2=80=93 which require the al= ways modifier. There is code which expects that implicit mapping and mapping wit= hout always modifier also works.) For pointers, at least OpenMP 5.0 seems to require that the POINTER target = is automatically mapped: module m implicit none integer, pointer :: p1 =3D> null() integer, pointer :: p1 =3D> null() integer, allocatable :: a1, a2(:) !$omp declare target(p1, p2, a1, a2) end module m use m implicit none integer, pointer :: q1, q2(:) q1 =3D> null() q2 =3D> null() integer, allocatable :: b1, b2(:) allocate (a1, source=3D12) allocate (a2, source=3D[11,22,33]) allocate (p1, source=3D42) allocate (p2, source=3D[1,3,5,7]) !$omp target data map(b1, b2, q1, q2) allocate (b1, source=3D35) allocate (b2, source=3D[10,11,12,13,14]) allocate (q1, source=3D4) allocate (q2, source=3D[9,8,7,6,5,4]) ! allocatable, TR9 requires 'always' modifier: !$omp target map(always, tofrom: a1, a2, b1, b2) if (.not. allocated(a1)) stop 1 if (.not. allocated(a2)) stop 1 if (.not. allocated(b1)) stop 1 if (.not. allocated(b2)) stop 1 if (size(a2) /=3D 3) stop 1 if (size(b2) /=3D 5) stop 1 if (a1 /=3D 12) stop 1 if (any (a2 /=3D [11,22,33])) stop 1 if (b1 /=3D 42) stop 1 if (any (b2 /=3D [10,11,12,13,14])) stop 1 a1 =3D 3 a2(:) =3D [44,55,66] b1 =3D 68 b2(:) =3D [101, 102, 103, 104, 105] !$omp end target ! pointer: allegedly target is automatically mapped ! without requiring an explicit mapping or even the always modifier !$omp target !! map(always, tofrom: p1, p2, q1, q2) if (.not. associated(p1)) stop 1 if (.not. associated(p2)) stop 1 if (.not. associated(q1)) stop 1 if (.not. associated(q2)) stop 1 if (size(p2) /=3D 4) stop 1 if (size(q2) /=3D 6) stop 1 if (p1 /=3D 42) stop 1 if (any (p2 /=3D [1,3,5,7])) stop 1 if (q1 /=3D 4) stop 1 if (any (q2 /=3D [9,8,7,6,5,4])) stop 1 p1 =3D 373 p2(:) =3D [2,4,6,8] q1 =3D 497 q2(:) =3D [-1, -2, -3, -4, -5, -6] !$omp end target !$omp end target data if (a1 /=3D 3) stop 1 if (any (a2 /=3D [44,55,66])) stop 1 if (b1 /=3D 68) stop 1 if (any (b2 /=3D [10,11,12,13,14])) stop 1 if (p1 /=3D 373) stop 1 if (any (p2 /=3D [2,4,6,8])) stop 1 if (q1 /=3D 397) stop 1 if (any (q2 /=3D [-1, -2, -3, -4, -5, -6])) stop 1 deallocate(a1, a2, b1, b2, p1, p2, q1, q2) end=