]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/58026 ([F03] Bad error recovery for allocatable component of undeclared...
authorJanus Weil <janus@gcc.gnu.org>
Sun, 12 Jan 2014 11:08:31 +0000 (12:08 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Sun, 12 Jan 2014 11:08:31 +0000 (12:08 +0100)
2014-01-12  Janus Weil  <janus@gcc.gnu.org>

PR fortran/58026
* decl.c (gfc_match_data_decl): Improve error recovery.

2014-01-12  Janus Weil  <janus@gcc.gnu.org>

PR fortran/58026
* gfortran.dg/alloc_comp_basics_6.f90: New.

From-SVN: r206564

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

index bb8c04c5a8a8c41b9711543c825c4d530d4989a3..f2f1a853ddfcc90c6c8af84266f2da476db7f440 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-12  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/58026
+       * decl.c (gfc_match_data_decl): Improve error recovery.
+
 2014-01-09  Tobias Burnus  <burnus@net-b.de>
 
        * cpp.c (gfc_cpp_handle_option): Add missing break.
index e8ac941a08257a4bb42b0fb01d80268a4eb9cb1f..8831b1997bd636698eac1233cbbc2b124acae2f6 100644 (file)
@@ -4287,12 +4287,10 @@ gfc_match_data_decl (void)
              || current_ts.u.derived->attr.zero_comp))
        goto ok;
 
-      /* Now we have an error, which we signal, and then fix up
-        because the knock-on is plain and simple confusing.  */
-      gfc_error_now ("Derived type at %C has not been previously defined "
-                    "and so cannot appear in a derived type definition");
-      current_attr.pointer = 1;
-      goto ok;
+      gfc_error ("Derived type at %C has not been previously defined "
+                "and so cannot appear in a derived type definition");
+      m = MATCH_ERROR;
+      goto cleanup;
     }
 
 ok:
index 3f33d768703c41fa3c76d1d504e8dfca5f803162..9d82746f57961f205612d24493924422f932db32 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-12  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/58026
+       * gfortran.dg/alloc_comp_basics_6.f90: New.
+
 2014-01-11  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/59700
diff --git a/gcc/testsuite/gfortran.dg/alloc_comp_basics_6.f90 b/gcc/testsuite/gfortran.dg/alloc_comp_basics_6.f90
new file mode 100644 (file)
index 0000000..3ed221d
--- /dev/null
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+! PR 58026: Bad error recovery for allocatable component of undeclared type
+!
+! Contributed by Joost VandeVondele <Joost.VandeVondele@mat.ethz.ch>
+
+  type sysmtx_t
+     type(ext_complex_t), allocatable :: S(:)  ! { dg-error "has not been previously defined" }
+  end type
+
+end