Commit c7f587bd by Paul Thomas

check.c (gfc_check_move_alloc): Introduce error to prevent aliasing between to and from arguments.

2016-11-05  Paul Thomas  <pault@gcc.gnu.org>

	* check.c (gfc_check_move_alloc): Introduce error to prevent
	aliasing between to and from arguments.

2016-11-05  Paul Thomas  <pault@gcc.gnu.org>

	* gfortran.dg/move_alloc_17.f03: New test.

From-SVN: r241872
parent 92657eb0
2016-11-05 Paul Thomas <pault@gcc.gnu.org>
* check.c (gfc_check_move_alloc): Introduce error to prevent
aliasing between to and from arguments.
2016-11-05 Janus Weil <janus@gcc.gnu.org>
Manuel Lopez-Ibanez <manu@gcc.gnu.org>
......
2016-11-05 Paul Thomas <pault@gcc.gnu.org>
* gfortran.dg/move_alloc_17.f03: New test.
2016-11-05 Richard Biener <rguenther@suse.de>
PR bootstrap/78188
......
! { dg-do compile }
!
! The call to MOVE_ALLOC below caused a seg fault in runtime.
! This was discussed in:
! https://groups.google.com/forum/#!topic/comp.lang.fortran/ZVLqXFYDZ0M
! Richard Maine proposed that the code violated the restrictions on
! actual arguments in F2003 12.4.1.7 and so the fix asserts that the
! TO and FROM arguments cannot be the same object or subobjects thereof.
!
!
program test_move_alloc
type :: linked_list
type(linked_list), allocatable :: link
integer :: value
end type linked_list
type(linked_list) :: test
allocate(test % link)
allocate(test % link % link)
call move_alloc(test % link, test % link % link) ! { dg-error "aliasing restrictions" }
end program test_move_alloc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment