aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/class.c
diff options
context:
space:
mode:
authorAndre Vehreschild <vehre@gcc.gnu.org>2016-10-25 19:01:58 +0200
committerAndre Vehreschild <vehre@gcc.gnu.org>2016-10-25 19:01:58 +0200
commitcef026ecafe169871284fded6494efe33e763950 (patch)
treeb0f80442a77baa418265d5ccf11e02c29050fe97 /gcc/fortran/class.c
parent6c3b5bf0725df869a12894682068b12dbf220568 (diff)
downloadgcc-cef026ecafe169871284fded6494efe33e763950.zip
gcc-cef026ecafe169871284fded6494efe33e763950.tar.gz
gcc-cef026ecafe169871284fded6494efe33e763950.tar.bz2
re PR fortran/72770 (ICE in make_ssa_name_fn, at tree-ssanames.c:263)
gcc/testsuite/ChangeLog: 2016-10-25 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/72770 * gfortran.dg/alloc_comp_class_5.f03: Added test again that caused this pr. gcc/fortran/ChangeLog: 2016-10-25 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/72770 * class.c (find_intrinsic_vtab): No longer encode the string length into vtype's name and use the char's kind for the size instead of the string_length time the size. * trans-array.c (gfc_conv_ss_descriptor): For deferred length char arrays the dynamically sized type needs to be declared. (build_class_array_ref): Address the i-th array element by multiplying it with the _vptr->_size and the _len to make sure char arrays are addressed correctly. * trans-expr.c (gfc_conv_intrinsic_to_class): Made comment more precise. From-SVN: r241528
Diffstat (limited to 'gcc/fortran/class.c')
-rw-r--r--gcc/fortran/class.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 6ac543c..be1ddf8 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -2515,11 +2515,6 @@ find_intrinsic_vtab (gfc_typespec *ts)
gfc_namespace *ns;
gfc_symbol *vtab = NULL, *vtype = NULL, *found_sym = NULL;
gfc_symbol *copy = NULL, *src = NULL, *dst = NULL;
- int charlen = 0;
-
- if (ts->type == BT_CHARACTER && !ts->deferred && ts->u.cl && ts->u.cl->length
- && ts->u.cl->length->expr_type == EXPR_CONSTANT)
- charlen = mpz_get_si (ts->u.cl->length->value.integer);
/* Find the top-level namespace. */
for (ns = gfc_current_ns; ns; ns = ns->parent)
@@ -2530,12 +2525,10 @@ find_intrinsic_vtab (gfc_typespec *ts)
{
char name[GFC_MAX_SYMBOL_LEN+1], tname[GFC_MAX_SYMBOL_LEN+1];
- if (ts->type == BT_CHARACTER)
- sprintf (tname, "%s_%d_%d", gfc_basic_typename (ts->type),
- charlen, ts->kind);
- else
- sprintf (tname, "%s_%d_", gfc_basic_typename (ts->type), ts->kind);
-
+ /* Encode all types as TYPENAME_KIND_ including especially character
+ arrays, whose length is now consistently stored in the _len component
+ of the class-variable. */
+ sprintf (tname, "%s_%d_", gfc_basic_typename (ts->type), ts->kind);
sprintf (name, "__vtab_%s", tname);
/* Look for the vtab symbol in the top-level namespace only. */
@@ -2600,9 +2593,8 @@ find_intrinsic_vtab (gfc_typespec *ts)
c->initializer = gfc_get_int_expr (gfc_default_integer_kind,
NULL,
ts->type == BT_CHARACTER
- && charlen == 0 ?
- ts->kind :
- (int)gfc_element_size (e));
+ ? ts->kind
+ : (int)gfc_element_size (e));
gfc_free_expr (e);
/* Add component _extends. */