From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 990B13858C53; Sat, 7 Oct 2023 13:13:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 990B13858C53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696684399; bh=A8F+zSU90uwIrRjgn/N80FEocHJPBfC4L4wdo5p0qlo=; h=From:To:Subject:Date:From; b=gUCBLenUxU7FJF42CUV99UzbFrFxXNc5IzW6LOBk8t5xC/qNJy8lSYUZQndosIdDF tCI1OEjAEu+iCMD8N1Zk8iy70ouC8hiofKXt9vwav59zeSyh/mle18e3cI7QwK2dBj /IKFy6k39QTYSS9dMlA4qHhl74MN9gDVZvXD2LiU= From: "pmblakely at googlemail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/111719] New: Omitting data-sharing attribute for function return value in OpenMP does not raise an error. Date: Sat, 07 Oct 2023 13:13:18 +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: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pmblakely at googlemail dot com 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 bug_severity priority component assigned_to reporter 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111719 Bug ID: 111719 Summary: Omitting data-sharing attribute for function return value in OpenMP does not raise an error. Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: pmblakely at googlemail dot com Target Milestone: --- In the following Fortran90 example: program prog contains function b(arr) implicit none integer :: i, xCells real(kind =3D 8) :: dx, a, dc, b, dt real(kind =3D 8), allocatable, dimension(:), intent(in) :: arr b =3D 1d300 dc =3D 1d300 !$OMP parallel do default(none) reduction(min:dt) firstprivate(xCells, dx, = a) shared(arr) do i =3D 0, xCells=20 a =3D arr(i) b =3D min(b, 1d0 / a) end do=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 end function b end program prog the return value for function 'b' is the intended reduction value in the do-loop, but is not mentioned in the OpenMP reduction clause (dt is incorre= ctly mentioned instead). Due to the default(none) clause, this should be a compile-time error. However: gfortran test.f90 -o test -fopenmp compiles this without warnings or errors (versions 13.1.0, 8.4.0, 9.4.0, 11= .2.0 and 12.1.0 all tested). If "b =3D min(b, 1d0 / a)" is replaced by "dc =3D min(dc, 1d0/a)" then gfortran gives: "Error: 'dc' not specified in enclosing =E2=80=98paral= lel=E2=80=99" I would expect this error to be generated in the original case as well. Note that the OpenMP standard at https://www.openmp.org/spec-html/5.2/openmpsu33.html does not give an implicitly determined data-sharing attribute for the function return value. Also the Intel Fortran ifort (2021.8.0) does raise the expected error on the above test-code.=