re PR fortran/41600 ([OOP] SELECT TYPE with associate-name => exp: Arrays not supported)

2012-01-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/41600
        * expr.c (gfc_default_initializer): Convert the values if
        the type does not match.

2012-01-29  Tobias Burnus  <burnus@net-b.de>

        PR fortran/41600
        * gfortran.dg/default_initialization_6.f90: New.


Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org>

From-SVN: r183682
This commit is contained in:
Tobias Burnus 2012-01-29 21:51:19 +01:00 committed by Tobias Burnus
parent cc19bc7fdd
commit 0b673c092d
4 changed files with 30 additions and 2 deletions

View file

@ -10,6 +10,12 @@
(write_blank_common): Call write_atom directly.
(write_symbol): Likewise.
2012-01-29 Tobias Burnus <burnus@net-b.de>
PR fortran/41600
* expr.c (gfc_default_initializer): Convert the values if
the type does not match.
2012-01-29 Tobias Burnus <burnus@net-b.de>
PR fortran/51972
@ -194,7 +200,7 @@
PR fortran/50556
* symbol.c (check_conflict): namelist-group-name cannot have the SAVE
attribure.
attribute.
2012-01-21 Tobias Burnus <burnus@net-b.de>

View file

@ -3774,7 +3774,13 @@ gfc_default_initializer (gfc_typespec *ts)
gfc_constructor *ctor = gfc_constructor_get();
if (comp->initializer)
ctor->expr = gfc_copy_expr (comp->initializer);
{
ctor->expr = gfc_copy_expr (comp->initializer);
if ((comp->ts.type != comp->initializer->ts.type
|| comp->ts.kind != comp->initializer->ts.kind)
&& !comp->attr.pointer && !comp->attr.proc_pointer)
gfc_convert_type_warn (ctor->expr, &comp->ts, 2, false);
}
if (comp->attr.allocatable
|| (comp->ts.type == BT_CLASS && CLASS_DATA (comp)->attr.allocatable))

View file

@ -1,3 +1,8 @@
2012-01-29 Tobias Burnus <burnus@net-b.de>
PR fortran/41600
* gfortran.dg/default_initialization_6.f90: New.
2012-01-29 Tobias Burnus <burnus@net-b.de>
PR fortran/51972

View file

@ -0,0 +1,11 @@
! { dg-do compile }
!
! PR fortran/41600
!
implicit none
type t
integer :: X = -999.0
end type t
class(t), allocatable :: y(:)
allocate (t :: y(1))
end