Commit edd2b56a by Janus Weil

re PR fortran/45577 (Bogus(?) "... type incompatible with source-expr ..." error)

2010-09-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45577
	* resolve.c (resolve_allocate_expr): Do default initialization via
	EXEC_INIT_ASSIGN.


2010-09-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45577
	* gfortran.dg/allocate_derived_4.f90: New.

From-SVN: r164305
parent ea395a11
2010-09-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/45577
* resolve.c (resolve_allocate_expr): Do default initialization via
EXEC_INIT_ASSIGN.
2010-09-11 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
* mathbuiltins.def: Do not defined huge_val built-in.
......
......@@ -6697,10 +6697,16 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
if (ts.type == BT_CLASS)
ts = ts.u.derived->components->ts;
if (ts.type == BT_DERIVED)
{
code->expr3 = gfc_default_initializer (&ts);
gfc_resolve_expr (code->expr3);
if (ts.type == BT_DERIVED && gfc_has_default_initializer(ts.u.derived))
{
gfc_expr *init_e = gfc_default_initializer (&ts);
gfc_code *init_st = gfc_get_code ();
init_st->loc = code->loc;
init_st->op = EXEC_INIT_ASSIGN;
init_st->expr1 = gfc_expr_to_initialize (e);
init_st->expr2 = init_e;
init_st->next = code->next;
code->next = init_st;
}
}
else if (code->expr3->mold && code->expr3->ts.type == BT_DERIVED)
......
2010-09-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/45577
* gfortran.dg/allocate_derived_4.f90: New.
2010-09-15 Tejas Belagod <tejas.belagod@arm.com>
* lib/target-supports.exp
......
! { dg-do compile }
!
! PR 45577: [4.6 Regression] Bogus(?) "... type incompatible with source-expr ..." error
!
! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
program main
type b_obj
integer,allocatable :: c(:)
real :: r = 5.
end type b_obj
type (b_obj),allocatable :: b(:)
integer,allocatable :: c(:)
allocate(b(3),c(3))
end program main
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