| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! Tests the fix for PR70864 in which compiler generated temporaries received |
| 4 |
! the attributes of a dummy argument. This is the original testcase. |
| 5 |
! The simplified version by Gerhard Steinmetz is gratefully acknowledged. |
| 6 |
! |
| 7 |
! Contributed by Weiqun Zhang <[email protected]> |
| 8 |
! |
| 9 |
module boxarray_module |
| 10 |
implicit none |
| 11 |
type :: BoxArray |
| 12 |
integer :: i = 0 |
| 13 |
contains |
| 14 |
procedure :: boxarray_assign |
| 15 |
generic :: assignment(=) => boxarray_assign |
| 16 |
end type BoxArray |
| 17 |
contains |
| 18 |
subroutine boxarray_assign (dst, src) |
| 19 |
class(BoxArray), intent(inout) :: dst |
| 20 |
type (BoxArray), intent(in ) :: src |
| 21 |
dst%i =src%i |
| 22 |
end subroutine boxarray_assign |
| 23 |
end module boxarray_module |
| 24 |
|
| 25 |
module multifab_module |
| 26 |
use boxarray_module |
| 27 |
implicit none |
| 28 |
type, public :: MultiFab |
| 29 |
type(BoxArray) :: ba |
| 30 |
end type MultiFab |
| 31 |
contains |
| 32 |
subroutine multifab_swap(mf1, mf2) |
| 33 |
type(MultiFab), intent(inout) :: mf1, mf2 |
| 34 |
type(MultiFab) :: tmp |
| 35 |
tmp = mf1 |
| 36 |
mf1 = mf2 ! Generated an ICE in trans-decl.c. |
| 37 |
mf2 = tmp |
| 38 |
end subroutine multifab_swap |
| 39 |
end module multifab_module |