<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82062>82062</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[flang] Missing diagnosis in referencing a non-pure final subroutine in a forall construct
</td>
</tr>
<tr>
<th>Labels</th>
<td>
bug,
flang:frontend
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kkwli
</td>
</tr>
</table>
<pre>
F2018:
> (C1037) Any procedure referenced in a _forall-body-construct_, including one referenced by a defined operation, assignment, or finalization, shall be a pure procedure.
```fortran
module m
type base
integer :: i
contains
final :: finalizeBase
end type
contains
subroutine finalizeBase(x)
type(base), intent(in) :: x
end subroutine
end module
program test
use m
type (base), allocatable :: b(:)
allocate(b(2))
b1%id = [ 1, 2 ]
forall (i=1:2)
b(i) = base(-i)
end forall
end
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcU92OszgMfZpwY7UCQ1q44KIzbO_2GUYJGJqdNKmSsDvdp_-UAP0ZqSpKYh8fH_sI79VkiFrGPxjvMjGHi3Xt9_d_WmXSDvf2jHlRs_LE8o7lJ1b-BQzrzyIvjwwbOJk73JztaZgdgaORHJmeBlAGBHyN1gmtdxFo11vjg5v78MXwE5Tp9TwoM4E1b4nyDgIGGpWhAeyNnAjKmpiycL2SCfFkHYzKCK3-fwT4i9AaJIGAW6TzILZfyS__h3z5jdYFJ8xye7XDrAmuywkg3G8EUnjaLgCUCTSRgyhGeQK1vfTWBKGMf0YmYlvcypI-XsDIDKnCK6_fMH6Wzs5BGXqHwPqHYfMslnCwTlyxWbQNSaRamTijlcfPa_En-HIb7xYJXindnJ2cuEIgH9bs2f8W6b220Nr2IgipaSssGaYF2khv2WtoIs-wxoSwNSYLhlwNwMoOGP-AIoIjMN69gywbFkkoVnYFK0_4po5ML0mFbpkn1jv1EhI7X0AeSvzak2xoy6EpG5FRWxzzusCy4VV2aeXhcORVzY-HIxd50_OxGvkgC6rEsch7nqkWc6xyLA6IHMtqj0WN1XgQVBRNf6wrVuV0FUrvtf73urduypT3M7U15gfMtJCkfbImopwnhsjwkyGOWpiJlafR2TjqIT7wLnNthNnJefKsyrXywT-Bgwo62XxJ5h38rbyPBhyUmIz1ykfTbk6MDwKMNbtkpWWjX1Yy-XsV_-HsbHa6vYRw82neZ4bnSYXLLPe9vTI8RzLrZ3dz9h_qA8NzatkzPKeu_wQAAP__pxBeVQ">