diff options
author | Tobias Burnus <burnus@net-b.de> | 2012-01-29 21:51:19 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2012-01-29 21:51:19 +0100 |
commit | 0b673c092d05972aba4b99a47b4aea039f022d79 (patch) | |
tree | 3a7105a717a7135837ca23018baeaa96120e3127 /gcc/fortran/expr.c | |
parent | cc19bc7fdd93110ad07d6a6e2e28bdc974593df8 (diff) | |
download | gcc-0b673c092d05972aba4b99a47b4aea039f022d79.zip gcc-0b673c092d05972aba4b99a47b4aea039f022d79.tar.gz gcc-0b673c092d05972aba4b99a47b4aea039f022d79.tar.bz2 |
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
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index c401313..129ece3 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -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)) |