aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2010-03-14 14:18:28 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2010-03-14 14:18:28 +0100
commit4eceddd75855810222b76a1aa96d5cbfe41daa50 (patch)
tree1a01b6c272626c479a7165c02e5abb8cd5acdb91 /gcc/fortran/resolve.c
parent9fd6e05c4a4ba724087d037528c867c60cc4594c (diff)
downloadgcc-4eceddd75855810222b76a1aa96d5cbfe41daa50.zip
gcc-4eceddd75855810222b76a1aa96d5cbfe41daa50.tar.gz
gcc-4eceddd75855810222b76a1aa96d5cbfe41daa50.tar.bz2
re PR fortran/43362 (ICE with structure constuctor with DT component)
2010-03-14 Tobias Burnus <burnus@net-b.de> PR fortran/43362 * resolve.c (resolve_structure_cons): Add missing PURE * constraint. (resolve_ordinary_assign): Add check to avoid segfault. 2010-03-14 Tobias Burnus <burnus@net-b.de> PR fortran/43362 * gfortran.dg/impure_constructor_1.f90: New test. From-SVN: r157447
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 9a95d34..774dfe4 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -921,6 +921,16 @@ resolve_structure_cons (gfc_expr *expr)
"for pointer component '%s' should be a POINTER or "
"a TARGET", &cons->expr->where, comp->name);
}
+
+ /* F2003, C1272 (3). */
+ if (gfc_pure (NULL) && cons->expr->expr_type == EXPR_VARIABLE
+ && gfc_impure_variable (cons->expr->symtree->n.sym))
+ {
+ t = FAILURE;
+ gfc_error ("Invalid expression in the derived type constructor for pointer "
+ "component '%s' at %L in PURE procedure", comp->name,
+ &cons->expr->where);
+ }
}
return t;
@@ -7947,6 +7957,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
if (lhs->ts.type == BT_DERIVED
&& lhs->expr_type == EXPR_VARIABLE
&& lhs->ts.u.derived->attr.pointer_comp
+ && rhs->expr_type == EXPR_VARIABLE
&& gfc_impure_variable (rhs->symtree->n.sym))
{
gfc_error ("The impure variable at %L is assigned to "