Commit 8019105d by Paul Thomas

re PR fortran/58771 (ICE in transfer_expr, at fortran/trans-io.c:2164)

2013-11-04  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/58771
	* trans-io.c (transfer_expr): If the backend_decl for a derived
	type is missing, build it with gfc_typenode_for_spec.

2013-11-04  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/58771
	* gfortran.dg/derived_external_function_1.f90 : New test

From-SVN: r204358
parent 7e8c8abc
2013-11-04 Paul Thomas <pault@gcc.gnu.org> 2013-11-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/58771
* trans-io.c (transfer_expr): If the backend_decl for a derived
type is missing, build it with gfc_typenode_for_spec.
2013-11-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/57445 PR fortran/57445
* trans-expr.c (gfc_conv_class_to_class): Remove spurious * trans-expr.c (gfc_conv_class_to_class): Remove spurious
assert. assert.
......
...@@ -2146,6 +2146,12 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code) ...@@ -2146,6 +2146,12 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code)
expr = build_fold_indirect_ref_loc (input_location, expr = build_fold_indirect_ref_loc (input_location,
expr); expr);
/* Make sure that the derived type has been built. An external
function, if only referenced in an io statement, requires this
check (see PR58771). */
if (ts->u.derived->backend_decl == NULL_TREE)
tmp = gfc_typenode_for_spec (ts);
for (c = ts->u.derived->components; c; c = c->next) for (c = ts->u.derived->components; c; c = c->next)
{ {
field = c->backend_decl; field = c->backend_decl;
......
2013-11-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/58771
* gfortran.dg/derived_external_function_1.f90 : New test
2013-11-04 Jakub Jelinek <jakub@redhat.com> 2013-11-04 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/58978 PR tree-optimization/58978
......
! { dg-do run }
!
! PR fortran/58771
!
! Contributed by Vittorio Secca <zeccav@gmail.com>
!
! ICEd on the write statement with f() because the derived type backend
! declaration not built.
!
module m
type t
integer(4) g
end type
end
type(t) function f() result(ff)
use m
ff%g = 42
end
use m
character (20) :: line1, line2
type(t) f
write (line1, *) f()
write (line2, *) 42_4
if (line1 .ne. line2) call abort
end
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