PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / move_alloc_17.f90
blobacede0f901bc72ace8dfc4c205e5b3313a660452
1 ! { dg-do compile }
3 ! The call to MOVE_ALLOC below caused a seg fault in runtime.
4 ! This was discussed in:
5 ! https://groups.google.com/forum/#!topic/comp.lang.fortran/ZVLqXFYDZ0M
6 ! Richard Maine proposed that the code violated the restrictions on
7 ! actual arguments in F2003 12.4.1.7 and so the fix asserts that the
8 ! TO and FROM arguments cannot be the same object or subobjects thereof.
11 program test_move_alloc
12 type :: linked_list
13 type(linked_list), allocatable :: link
14 integer :: value
15 end type linked_list
16 type(linked_list) :: test
18 allocate(test % link)
19 allocate(test % link % link)
20 call move_alloc(test % link, test % link % link) ! { dg-error "aliasing restrictions" }
21 end program test_move_alloc