+2017-11-03 Paul Thomas <pault@gcc.gnu.org>
+
+ Backport from 7-branch
+ PR fortran/81735
+ * trans-decl.c (gfc_trans_deferred_vars): Correct case where
+ 'tmp' can be used unititialized.
+
2017-11-01 Andre Vehreschild <vehre@gcc.gnu.org>
Paul Thomas <pault@gcc.gnu.org>
&& sym->ts.u.cl->passed_length)
tmp = gfc_null_and_pass_deferred_len (sym, &init, &loc);
else
- gfc_restore_backend_locus (&loc);
+ {
+ gfc_restore_backend_locus (&loc);
+ tmp = NULL_TREE;
+ }
/* Deallocate when leaving the scope. Nullifying is not
needed. */
+2017-11-03 Paul Thomas <pault@gcc.gnu.org>
+
+ Backport from 7-branch
+ PR fortran/81735
+ * gfortran.dg/pr81735.f90: New test.
+
2017-11-01 Paul Thomas <pault@gcc.gnu.org>
Backport from trunk
--- /dev/null
+! { dg-do compile }
+! { dg-options "-fdump-tree-original" }
+!
+! Contributed by Danila <flashmozzg@gmail.com>
+!
+program fooprog
+ implicit none
+ type FooType
+ integer, allocatable :: x
+ end type FooType
+
+ type(FooType), pointer :: bar
+
+ bar => foo()
+
+contains
+ function foo() result(res)
+ type(FooType), pointer :: res
+
+ character(:), allocatable :: rt
+ rt = ""
+ res => null()
+ end function foo
+end program fooprog
+! { dg-final { scan-tree-dump-times "__builtin_free" 1 "original" } }