public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/111719] New: Omitting data-sharing attribute for function return value in OpenMP does not raise an error.
@ 2023-10-07 13:13 pmblakely at googlemail dot com
0 siblings, 0 replies; only message in thread
From: pmblakely at googlemail dot com @ 2023-10-07 13:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111719
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 = 8) :: dx, a, dc, b, dt
real(kind = 8), allocatable, dimension(:), intent(in) :: arr
b = 1d300
dc = 1d300
!$OMP parallel do default(none) reduction(min:dt) firstprivate(xCells, dx, a)
shared(arr)
do i = 0, xCells
a = arr(i)
b = min(b, 1d0 / a)
end do
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 incorrectly
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 = min(b, 1d0 / a)" is replaced by "dc = min(dc, 1d0/a)"
then gfortran gives: "Error: 'dc' not specified in enclosing ‘parallel’"
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-07 13:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-07 13:13 [Bug fortran/111719] New: Omitting data-sharing attribute for function return value in OpenMP does not raise an error pmblakely at googlemail dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).