OSDN Git Service

2010-03-14 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 14 Mar 2010 13:18:28 +0000 (13:18 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 00:23:31 +0000 (09:23 +0900)
        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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157447 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog

index 9fd831d..dd809d9 100644 (file)
@@ -1,3 +1,9 @@
+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-12  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/43291
index 9a95d34..774dfe4 100644 (file)
@@ -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 "
index 336e2e3..47a80da 100644 (file)
@@ -1,3 +1,8 @@
+2010-03-14  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/43362
+       * gfortran.dg/impure_constructor_1.f90: New test.
+
 2010-03-13  Sebastian Pop  <sebastian.pop@amd.com>
 
        PR middle-end/43354