Commit 204d4630 by Paul Thomas

re PR fortran/85603 (ICE with character array substring assignment)

2018-09-22  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/85603
	* trans-array.c (gfc_alloc_allocatable_for_assignment): Test
	the charlen backend_decl before using the VAR_P macro.

2018-09-22  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/85603
	* gfortran.dg/deferred_character_23.f90 : New test.

From-SVN: r264502
parent 0e569a3c
2018-09-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/85603
* trans-array.c (gfc_alloc_allocatable_for_assignment): Test
the charlen backend_decl before using the VAR_P macro.
2018-09-21 Paul Thomas <pault@gcc.gnu.org> 2018-09-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/77325 PR fortran/77325
......
...@@ -9950,7 +9950,8 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop, ...@@ -9950,7 +9950,8 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
{ {
if (expr2->ts.deferred) if (expr2->ts.deferred)
{ {
if (VAR_P (expr2->ts.u.cl->backend_decl)) if (expr2->ts.u.cl->backend_decl
&& VAR_P (expr2->ts.u.cl->backend_decl))
tmp = expr2->ts.u.cl->backend_decl; tmp = expr2->ts.u.cl->backend_decl;
else else
tmp = rss->info->string_length; tmp = rss->info->string_length;
......
2018-09-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/85603
* gfortran.dg/deferred_character_23.f90 : New test.
2018-09-21 Jeff Law <law@redhat.com> 2018-09-21 Jeff Law <law@redhat.com>
* gcc.dg/tree-ssa/vrp113.c: Disable EVRP. * gcc.dg/tree-ssa/vrp113.c: Disable EVRP.
......
! { dg-do run }
!
! Tests the fix for PR85603.
!
! Contributed by Walt Spector <w6ws@earthlink.net>
!
program strlen_bug
implicit none
character(:), allocatable :: strings(:)
integer :: maxlen
strings = [ character(32) :: &
'short', &
'somewhat longer' ]
maxlen = maxval (len_trim (strings))
if (maxlen .ne. 15) stop 1
strings = strings(:)(:maxlen) ! Used to ICE
if (any (strings .ne. ['short ','somewhat longer'])) stop 2
deallocate (strings) ! To check for memory leaks
end program
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