https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117765

--- Comment #8 from kargls at comcast dot net ---
(In reply to anlauf from comment #7)
> The patch catches functions but misses subroutine calls, as in:
> 
> ! { dg-do compile }
> !
> program foo
> 
>    implicit none
> 
>    integer i
>    integer :: j = 0
>    real y(4)
> 
>    do concurrent(i=1:4)
>       y(i) = bar(i)        ! { dg-error "Reference to impure function" }
>       call bla(i)      ! <<< caught
>    end do
> 
>    do concurrent(i=1:4)
>       block
>          y(i) = bar(i)     ! { dg-error "Reference to impure function" }
>          call bla(i)   ! <<< MISSED!
>       end block
>    end do
> 
>    contains
> 
>       impure function bar(i)
>          real bar
>          integer, intent(in) :: i
>          j = j + i
>          bar = j
>       end function bar
> 
>       impure subroutine bla (j)
>          integer, intent(in) :: j
>          print *, j
>       end subroutine bla
> 
> end program foo
> 
> 
> If possible, can we fix that, too?
> 
> Thanks!

Nice catch.  I did not consider impure subroutines (obviously).
It seems that resolve.cc does not have a check_pure_subroutine()
like it does for functions.  I peek at the source code later 
today.

Reply via email to