OSDN Git Service

2006-02-02 Steven G. Kargl <kargls@comcast>
authorkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Feb 2006 19:11:58 +0000 (19:11 +0000)
committerkargl <kargl@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Feb 2006 19:11:58 +0000 (19:11 +0000)
PR fortran/24958
match.c (gfc_match_nullify):  Free the list from head not tail.

PR fortran/25072
* match.c (match_forall_header): Fix internal error caused by bogus
gfc_epxr pointers.

gfortran.dg/nullify_2.f90: New test.

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

gcc/fortran/ChangeLog
gcc/fortran/match.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/nullify_2.f90 [new file with mode: 0644]

index 517535b..80a453d 100644 (file)
@@ -1,3 +1,13 @@
+2006-02-02  Steven G. Kargl  <kargls@comcast>
+
+       PR fortran/24958
+       match.c (gfc_match_nullify):  Free the list from head not tail.
+
+       PR fortran/25072
+       * match.c (match_forall_header): Fix internal error caused by bogus
+       gfc_epxr pointers.
+
+
 2006-01-31  Thomas Koenig  <Thomas.Koenig@online.de>
 
        PR fortran/26039
index 40355d2..f726224 100644 (file)
@@ -1890,7 +1890,7 @@ syntax:
   gfc_syntax_error (ST_NULLIFY);
 
 cleanup:
-  gfc_free_statements (tail);
+  gfc_free_statements (new_st.next);
   return MATCH_ERROR;
 }
 
@@ -3367,12 +3367,13 @@ static match
 match_forall_header (gfc_forall_iterator ** phead, gfc_expr ** mask)
 {
   gfc_forall_iterator *head, *tail, *new;
+  gfc_expr *msk;
   match m;
 
   gfc_gobble_whitespace ();
 
   head = tail = NULL;
-  *mask = NULL;
+  msk = NULL;
 
   if (gfc_match_char ('(') != MATCH_YES)
     return MATCH_NO;
@@ -3393,6 +3394,7 @@ match_forall_header (gfc_forall_iterator ** phead, gfc_expr ** mask)
       m = match_forall_iterator (&new);
       if (m == MATCH_ERROR)
        goto cleanup;
+
       if (m == MATCH_YES)
        {
          tail->next = new;
@@ -3402,7 +3404,7 @@ match_forall_header (gfc_forall_iterator ** phead, gfc_expr ** mask)
 
       /* Have to have a mask expression */
 
-      m = gfc_match_expr (mask);
+      m = gfc_match_expr (&msk);
       if (m == MATCH_NO)
        goto syntax;
       if (m == MATCH_ERROR)
@@ -3415,13 +3417,14 @@ match_forall_header (gfc_forall_iterator ** phead, gfc_expr ** mask)
     goto syntax;
 
   *phead = head;
+  *mask = msk;
   return MATCH_YES;
 
 syntax:
   gfc_syntax_error (ST_FORALL);
 
 cleanup:
-  gfc_free_expr (*mask);
+  gfc_free_expr (msk);
   gfc_free_forall_iterator (head);
 
   return MATCH_ERROR;
index 5d4cff5..217aad8 100644 (file)
@@ -1,3 +1,8 @@
+2006-02-02  Steven G. Kargl  <kargls@comcast>
+
+       PR fortran/24958
+        gfortran.dg/nullify_2.f90: New test.
+
 2006-02-02  Diego Novillo  <dnovillo@redhat.com>
 
        PR 25990
diff --git a/gcc/testsuite/gfortran.dg/nullify_2.f90 b/gcc/testsuite/gfortran.dg/nullify_2.f90
new file mode 100644 (file)
index 0000000..ebfcb37
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR fortran/25146
+program i
+   implicit none
+   TYPE (a) t1     ! { dg-error "is being used before" }
+   nullify(t1%x)   ! { dg-error "error in NULLIFY" }
+end program