aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-types.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2017-11-23 09:52:04 +0000
committerPaul Thomas <pault@gcc.gnu.org>2017-11-23 09:52:04 +0000
commitf36a7f04f65f3e11e2c656e4171657acf59f3655 (patch)
treefb63a6bad613369a7c94717b06feb22ab3cf50b0 /gcc/fortran/trans-types.c
parentd7a160a45ea7ed09247788c708721c2813cf0007 (diff)
downloadgcc-f36a7f04f65f3e11e2c656e4171657acf59f3655.zip
gcc-f36a7f04f65f3e11e2c656e4171657acf59f3655.tar.gz
gcc-f36a7f04f65f3e11e2c656e4171657acf59f3655.tar.bz2
re PR fortran/82814 (ICE from submodule character function)
2017-11-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/82814 * trans-types.c (gfc_sym_type): If a character function result is missing the charlen backend_decl, use the one from the name- space procedure symbol, if present. 2017-11-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/82814 * gfortran.dg/submodule_31.f08: New test. From-SVN: r255094
Diffstat (limited to 'gcc/fortran/trans-types.c')
-rw-r--r--gcc/fortran/trans-types.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index b4ddfdb..6868329 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2201,6 +2201,12 @@ gfc_sym_type (gfc_symbol * sym)
if (sym->backend_decl && !sym->attr.function)
return TREE_TYPE (sym->backend_decl);
+ if (sym->attr.result
+ && sym->ts.type == BT_CHARACTER
+ && sym->ts.u.cl->backend_decl == NULL_TREE
+ && sym->ns->proc_name->ts.u.cl->backend_decl != NULL_TREE)
+ sym->ts.u.cl->backend_decl = sym->ns->proc_name->ts.u.cl->backend_decl;
+
if (sym->ts.type == BT_CHARACTER
&& ((sym->attr.function && sym->attr.is_bind_c)
|| (sym->attr.result