From 874be74ab3d68a57e7938900e9e1364b8101ade9 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Mon, 15 Aug 2016 19:34:48 +0000 Subject: [PATCH] frontend-passes.c (create_var): Set ts.deferred for deferred-length character variables. 2016-08-15 Thomas Koenig * frontend-passes.c (create_var): Set ts.deferred for deferred-length character variables. * dump-parse-tree.c (show_typespec): Also dump is_c_interop, is_iso_c and deferred flags. From-SVN: r239488 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/dump-parse-tree.c | 8 ++++++++ gcc/fortran/frontend-passes.c | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5972a3e7e6f..84bfb334168 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2016-08-15 Thomas Koenig + + * frontend-passes.c (create_var): Set ts.deferred for + deferred-length character variables. + * dump-parse-tree.c (show_typespec): Also dump + is_c_interop, is_iso_c and deferred flags. + 2016-08-15 Jakub Jelinek PR debug/71906 diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index f50743475d3..8c240742150 100644 --- a/gcc/fortran/dump-parse-tree.c +++ b/gcc/fortran/dump-parse-tree.c @@ -120,6 +120,14 @@ show_typespec (gfc_typespec *ts) fprintf (dumpfile, "%d", ts->kind); break; } + if (ts->is_c_interop) + fputs (" C_INTEROP", dumpfile); + + if (ts->is_iso_c) + fputs (" ISO_C", dumpfile); + + if (ts->deferred) + fputs (" DEFERRED", dumpfile); fputc (')', dumpfile); } diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 29e43a11138..3892069d057 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -616,6 +616,7 @@ create_var (gfc_expr * e, const char *vname) gfc_code *n; gfc_namespace *ns; int i; + bool deferred; if (e->expr_type == EXPR_CONSTANT || is_fe_temp (e)) return gfc_copy_expr (e); @@ -666,6 +667,7 @@ create_var (gfc_expr * e, const char *vname) } } + deferred = 0; if (e->ts.type == BT_CHARACTER && e->rank == 0) { gfc_expr *length; @@ -675,7 +677,10 @@ create_var (gfc_expr * e, const char *vname) if (length) symbol->ts.u.cl->length = length; else - symbol->attr.allocatable = 1; + { + symbol->attr.allocatable = 1; + deferred = 1; + } } symbol->attr.flavor = FL_VARIABLE; @@ -687,6 +692,7 @@ create_var (gfc_expr * e, const char *vname) result = gfc_get_expr (); result->expr_type = EXPR_VARIABLE; result->ts = e->ts; + result->ts.deferred = deferred; result->rank = e->rank; result->shape = gfc_copy_shape (e->shape, e->rank); result->symtree = symtree; -- 2.30.2