]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/56266 ([OOP] ICE on invalid in gfc_match_varspec)
authorJanus Weil <janus@gcc.gnu.org>
Fri, 12 Apr 2013 21:41:50 +0000 (23:41 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Fri, 12 Apr 2013 21:41:50 +0000 (23:41 +0200)
2013-04-12  Janus Weil  <janus@gcc.gnu.org>

PR fortran/56266
* primary.c (gfc_match_varspec): Turn gcc_assert into MATCH_ERROR.

2013-04-12  Janus Weil  <janus@gcc.gnu.org>

PR fortran/56266
* gfortran.dg/typebound_proc_28.f03: New.

From-SVN: r197936

gcc/fortran/ChangeLog
gcc/fortran/primary.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/typebound_proc_28.f03 [new file with mode: 0644]

index c2b8a5d70bec4448e375f8179a55b71e08de4511..ace16ad1bf2867d06986c84d18d71315b0de4b60 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-12  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/56266
+       * primary.c (gfc_match_varspec): Turn gcc_assert into MATCH_ERROR.
+
 2013-04-12  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/56929
index cd8a41755944ef1a984b2bc54b70655ee35e8631..1276abb3aa7b4e0e12ae6b0110ed3cefd5254c4d 100644 (file)
@@ -1953,10 +1953,12 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
            return MATCH_ERROR;
 
          gcc_assert (!tail || !tail->next);
-         gcc_assert (primary->expr_type == EXPR_VARIABLE
-                     || (primary->expr_type == EXPR_STRUCTURE
-                         && primary->symtree && primary->symtree->n.sym
-                         && primary->symtree->n.sym->attr.flavor));
+
+         if (!(primary->expr_type == EXPR_VARIABLE
+               || (primary->expr_type == EXPR_STRUCTURE
+                   && primary->symtree && primary->symtree->n.sym
+                   && primary->symtree->n.sym->attr.flavor)))
+           return MATCH_ERROR;
 
          if (tbp->n.tb->is_generic)
            tbp_sym = NULL;
index 90dd664d6b723c782681386feb470b27aa81029d..c99fee879986dadc211ba724631f30a96e813294 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-12  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/56266
+       * gfortran.dg/typebound_proc_28.f03: New.
+
 2013-04-12  Jeff Law  <law@redhat.com>
 
        * gcc.dg/tree-ssa/vrp87.c: Do not run test on ppc and xtensa
diff --git a/gcc/testsuite/gfortran.dg/typebound_proc_28.f03 b/gcc/testsuite/gfortran.dg/typebound_proc_28.f03
new file mode 100644 (file)
index 0000000..74199c3
--- /dev/null
@@ -0,0 +1,30 @@
+! { dg-do compile }
+!
+! PR 56266: [OOP] ICE on invalid in gfc_match_varspec
+!
+! Contributed by Andrew Benson <abensonca@gmail.com>
+
+module t
+
+  implicit none
+
+  type nc
+   contains
+     procedure :: encM => em
+  end type nc
+
+contains
+
+  double precision function em(self)
+    class(nc) :: self
+    em=0.
+  end function
+
+  double precision function cem(c)
+    type(nc) :: c
+    cem=c(i)%encM()   ! { dg-error "Unclassifiable statement" }
+  end function
+
+end module
+
+! { dg-final { cleanup-modules "t" } }