re PR fortran/81735 (double free or corruption (fasttop) error (SIGABRT) with character(:) and custom return type with allocatable)
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-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/81735 * gfortran.dg/pr81735.f90: New test. From-SVN: r254404
This commit is contained in:
parent
9cfdd48417
commit
77dacf9da6
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
@ -4584,7 +4584,10 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
|
||||
&& 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. */
|
||||
@ -4636,10 +4639,6 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
|
||||
}
|
||||
|
||||
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)
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
25
gcc/testsuite/gfortran.dg/pr81735.f90
Normal file
25
gcc/testsuite/gfortran.dg/pr81735.f90
Normal file
@ -0,0 +1,25 @@
|
||||
! { 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" } }
|
Loading…
Reference in New Issue
Block a user