aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2013-05-31 11:41:53 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2013-05-31 11:41:53 +0200
commit2bdf1c75e432bb2a20e9b6de02c015736b22aa44 (patch)
tree4511aef20055a51c7a4900e5ca7da1efa573f5b8 /gcc/fortran
parentb6af05a9b34eab3b8aafa34b54adbec2c70a304f (diff)
downloadgcc-2bdf1c75e432bb2a20e9b6de02c015736b22aa44.zip
gcc-2bdf1c75e432bb2a20e9b6de02c015736b22aa44.tar.gz
gcc-2bdf1c75e432bb2a20e9b6de02c015736b22aa44.tar.bz2
re PR fortran/57456 ([OOP] CLASS + CHARACTER ALLOCATE with typespec: For arrays, the typespec is ignored)
2013-05-31 Tobias Burnus <burnus@net-b.de> PR fortran/57456 * trans-array.c (gfc_array_init_size): Use passed type spec, when available. (gfc_array_allocate): Pass typespec on. * trans-array.h (gfc_array_allocate): Update prototype. * trans-stmt.c (gfc_trans_allocate): Pass typespec on. 2013-05-31 Tobias Burnus <burnus@net-b.de> PR fortran/57456 * gfortran.dg/class_array_17.f90: New. From-SVN: r199528
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog9
-rw-r--r--gcc/fortran/trans-array.c10
-rw-r--r--gcc/fortran/trans-array.h2
-rw-r--r--gcc/fortran/trans-stmt.c2
4 files changed, 18 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index db8d1d0..8447e7a 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,12 @@
+2013-05-31 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/57456
+ * trans-array.c (gfc_array_init_size): Use passed type spec,
+ when available.
+ (gfc_array_allocate): Pass typespec on.
+ * trans-array.h (gfc_array_allocate): Update prototype.
+ * trans-stmt.c (gfc_trans_allocate): Pass typespec on.
+
2013-05-31 Janus Weil <janus@gcc.gnu.org>
PR fortran/54190
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index be3a5a0..8556278 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -4834,7 +4834,8 @@ static tree
gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
gfc_expr ** lower, gfc_expr ** upper, stmtblock_t * pblock,
stmtblock_t * descriptor_block, tree * overflow,
- tree expr3_elem_size, tree *nelems, gfc_expr *expr3)
+ tree expr3_elem_size, tree *nelems, gfc_expr *expr3,
+ gfc_typespec *ts)
{
tree type;
tree tmp;
@@ -5012,6 +5013,9 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
tmp = TYPE_SIZE_UNIT (tmp);
}
}
+ else if (ts->type != BT_UNKNOWN && ts->type != BT_CHARACTER)
+ /* FIXME: Properly handle characters. See PR 57456. */
+ tmp = TYPE_SIZE_UNIT (gfc_typenode_for_spec (ts));
else
tmp = TYPE_SIZE_UNIT (gfc_get_element_type (type));
@@ -5081,7 +5085,7 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
bool
gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
tree errlen, tree label_finish, tree expr3_elem_size,
- tree *nelems, gfc_expr *expr3)
+ tree *nelems, gfc_expr *expr3, gfc_typespec *ts)
{
tree tmp;
tree pointer;
@@ -5166,7 +5170,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
size = gfc_array_init_size (se->expr, ref->u.ar.as->rank,
ref->u.ar.as->corank, &offset, lower, upper,
&se->pre, &set_descriptor_block, &overflow,
- expr3_elem_size, nelems, expr3);
+ expr3_elem_size, nelems, expr3, ts);
if (dimension)
{
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index 6f44d79..d00e156 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -24,7 +24,7 @@ tree gfc_array_deallocate (tree, tree, tree, tree, tree, gfc_expr*);
/* Generate code to initialize and allocate an array. Statements are added to
se, which should contain an expression for the array descriptor. */
bool gfc_array_allocate (gfc_se *, gfc_expr *, tree, tree, tree, tree,
- tree, tree *, gfc_expr *);
+ tree, tree *, gfc_expr *, gfc_typespec *);
/* Allow the bounds of a loop to be set from a callee's array spec. */
void gfc_set_loop_bounds_from_array_spec (gfc_interface_mapping *,
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 7812934..7759b86 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -4925,7 +4925,7 @@ gfc_trans_allocate (gfc_code * code)
nelems = NULL_TREE;
if (!gfc_array_allocate (&se, expr, stat, errmsg, errlen, label_finish,
- memsz, &nelems, code->expr3))
+ memsz, &nelems, code->expr3, &code->ext.alloc.ts))
{
bool unlimited_char;