https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119836
Bug ID: 119836
Summary: [15 Regression] Elemental intrinsic treated as IMPURE
within BLOCK within DO CONCURRENT
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: anlauf at gcc dot gnu.org
Target Milestone: ---
See also thread starting here:
https://gcc.gnu.org/pipermail/fortran/2025-April/062044.html
My crystal ball suggests the following testcase:
program p
implicit none
integer, parameter :: n = 4
integer :: i
integer :: y(n), x(n)
do concurrent (i=1:n)
x(i) = shiftl (i,1) ! accepted
block
y(i) = shiftl (i,1) ! wrongly rejected
end block
end do
print *, y
end
I get:
foo.f90:9:14:
9 | y(i) = shiftl (i,1) ! wrongly rejected
| 1
Error: Reference to impure function at (1) inside a DO CONCURRENT