+2017-11-04 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/81735
+ * trans-decl.c (gfc_trans_deferred_vars): Do a better job of a
+ case where 'tmp' was used unititialized and remove TODO.
+
2017-11-03 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/82796
&& 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. */
}
gfc_add_init_cleanup (block, gfc_finish_block (&init), tmp);
- /* TODO find out why this is necessary to stop double calls to
- free. Somebody is reusing the expression in 'tmp' because
- it is being used unititialized. */
- tmp = NULL_TREE;
}
}
else if (sym->ts.type == BT_CHARACTER && sym->ts.deferred)
+2017-11-04 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/81735
+ * gfortran.dg/pr81735.f90: New test.
+
2017-11-03 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/82796
--- /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" } }