| ! Test fix of PR109066, which caused segfaults as below |
| ! Contributed by Andrew Benson <abensonca@gcc.gnu.org> |
| generic :: assignment(=) => rma |
| impure elemental subroutine rma(to,from) |
| class(rm), intent(out) :: to |
| class(rm), intent(in) :: from |
| type(lc), pointer :: i, j(:) |
| i = lc (rm (1)) ! Segmentation fault |
| if (i%lm%c .ne. -1) stop 1 |
| i = i_ptr () ! Segmentation fault |
| if (i%lm%c .ne. 1) stop 2 |
| j = [lc (rm (2)), lc (rm (3))] ! Segmentation fault |
| if (any (j%lm%c .ne. [-2,-3])) stop 3 |
| if (any (j%lm%c .ne. [2,3])) stop 4 |
| function i_ptr () result(res) |
| function j_ptr () result(res) |
| type(lc), pointer :: res (:) |