aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/class.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-01-31 19:36:40 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2012-01-31 19:36:40 +0100
commit2419ff64b9d80647a79da9a6ae40e36e8206d4a2 (patch)
tree9b81e969cc1663e437719df6faab222044bd187a /gcc/fortran/class.c
parent2297ab7d840966f62a70328244f4c8560d388e0a (diff)
downloadgcc-2419ff64b9d80647a79da9a6ae40e36e8206d4a2.zip
gcc-2419ff64b9d80647a79da9a6ae40e36e8206d4a2.tar.gz
gcc-2419ff64b9d80647a79da9a6ae40e36e8206d4a2.tar.bz2
re PR fortran/52013 ([OOP] Polymorphism and coarrays: Support as class container)
2012-01-31 Tobias Burnus <burnus@net-b.de> PR fortran/52013 * class.c (get_unique_hashed_string): Adapt trim length. (gfc_build_class_symbol) Encode also corank in the container name. 2012-01-31 Tobias Burnus <burnus@net-b.de> PR fortran/52013 From-SVN: r183769
Diffstat (limited to 'gcc/fortran/class.c')
-rw-r--r--gcc/fortran/class.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 52c5a61..3ff6a0b 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -294,8 +294,10 @@ get_unique_hashed_string (char *string, gfc_symbol *derived)
char tmp[2*GFC_MAX_SYMBOL_LEN+2];
get_unique_type_string (&tmp[0], derived);
/* If string is too long, use hash value in hex representation (allow for
- extra decoration, cf. gfc_build_class_symbol & gfc_find_derived_vtab). */
- if (strlen (tmp) > GFC_MAX_SYMBOL_LEN - 11)
+ extra decoration, cf. gfc_build_class_symbol & gfc_find_derived_vtab).
+ We need space to for 15 characters "__class_" + symbol name + "_%d_%da",
+ where %d is the (co)rank which can be up to n = 15. */
+ if (strlen (tmp) > GFC_MAX_SYMBOL_LEN - 15)
{
int h = gfc_hash_value (derived);
sprintf (string, "%X", h);
@@ -360,10 +362,10 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute *attr,
/* Determine the name of the encapsulating type. */
get_unique_hashed_string (tname, ts->u.derived);
- if ((*as) && (*as)->rank && attr->allocatable)
- sprintf (name, "__class_%s_%d_a", tname, (*as)->rank);
- else if ((*as) && (*as)->rank)
- sprintf (name, "__class_%s_%d", tname, (*as)->rank);
+ if ((*as) && attr->allocatable)
+ sprintf (name, "__class_%s_%d_%da", tname, (*as)->rank, (*as)->corank);
+ else if ((*as))
+ sprintf (name, "__class_%s_%d_%d", tname, (*as)->rank, (*as)->corank);
else if (attr->pointer)
sprintf (name, "__class_%s_p", tname);
else if (attr->allocatable)