aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2019-11-15 12:42:29 +0000
committerPaul Thomas <pault@gcc.gnu.org>2019-11-15 12:42:29 +0000
commit8eea62d8ab9c621b9d46926eb4c5380fe5606e4f (patch)
tree0b00d12b35b993e30818f9b746cfe3c739dc780f /gcc/fortran/trans-expr.c
parent381835c810867b1cb4658de0ee9bacc59135010c (diff)
downloadgcc-8eea62d8ab9c621b9d46926eb4c5380fe5606e4f.zip
gcc-8eea62d8ab9c621b9d46926eb4c5380fe5606e4f.tar.gz
gcc-8eea62d8ab9c621b9d46926eb4c5380fe5606e4f.tar.bz2
re PR fortran/69654 (ICE in gfc_trans_structure_assign)
2019-11-15 Paul Thomas <pault@gcc.gnu.org> PR fortran/69654 * trans-expr.c (gfc_trans_structure_assign): Move assignment to 'cm' after treatment of C pointer types and test that the type has been completely built before it. Add an assert that the backend_decl for each component exists. 2019-11-15 Paul Thomas <pault@gcc.gnu.org> PR fortran/69654 * gfortran.dg/derived_init_6.f90: New test. From-SVN: r278287
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r--gcc/fortran/trans-expr.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 267536d..fe89c7b 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -8330,7 +8330,6 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray)
gfc_se se;
gfc_start_block (&block);
- cm = expr->ts.u.derived->components;
if (expr->ts.u.derived->from_intmod == INTMOD_ISO_C_BINDING
&& (expr->ts.u.derived->intmod_sym_id == ISOCBINDING_PTR
@@ -8348,6 +8347,17 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray)
return gfc_finish_block (&block);
}
+ /* Make sure that the derived type has been completely built. */
+ if (!expr->ts.u.derived->backend_decl
+ || !TYPE_FIELDS (expr->ts.u.derived->backend_decl))
+ {
+ tmp = gfc_typenode_for_spec (&expr->ts);
+ gcc_assert (tmp);
+ }
+
+ cm = expr->ts.u.derived->components;
+
+
if (coarray)
gfc_init_se (&se, NULL);
@@ -8418,6 +8428,7 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray)
gfc_add_expr_to_block (&block, tmp);
}
field = cm->backend_decl;
+ gcc_assert(field);
tmp = fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
dest, field, NULL_TREE);
if (!c->expr)