The attached patch removes an assert() that prevents gfortran from
issuing an error message.  Built and tested on x86_64-*-freebsd.
Althoug probably an "obviously correct" patch, OK to commit?

2015-10-19  Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/68019
        * decl.c (add_init_expr_to_sym): Remove an assert() to allow an error
        message to be issued.

2015-10-19  Steven G. Kargl  <ka...@gcc.gnu.org>

        PR fortran/68019
        * gfortran.dg/pr68019.f90: new test.

-- 
Steve
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 228974)
+++ gcc/fortran/decl.c	(working copy)
@@ -1486,7 +1486,6 @@ add_init_expr_to_sym (const char *name, 
 			 " with scalar", &sym->declared_at);
 	      return false;
 	    }
-	  gcc_assert (sym->as->rank == init->rank);
 
 	  /* Shape should be present, we get an initialization expression.  */
 	  gcc_assert (init->shape);
Index: gcc/testsuite/gfortran.dg/pr68019.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr68019.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/pr68019.f90	(working copy)
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! Original code from Gerhard Steinmetz
+! Gerhard dot Steinmetz for fortran at t-online dot de
+! PR fortran/68019
+!
+program p
+   integer :: i
+   type t
+      integer :: n
+   end type
+   type(t), parameter :: vec(*) = [(t(i), i = 1, 4)]
+   type(t), parameter :: arr(*) = reshape(vec, [2, 2])   ! { dg-error "ranks 1 and 2 in assignment" }
+end

Reply via email to