Re: [PATCH] fortran/68019 -- Remove an assert() that prevents error message

2015-10-19 Thread Steve Kargl
Thanks.  Patch committed to both 5-branch and trunk.

-- 
steve

On Mon, Oct 19, 2015 at 10:02:09PM +0200, Paul Richard Thomas wrote:
> Hi Steve,
> 
> Yes, this is OK for trunk. I suggest that it is so obvious that it
> should go into 5 branch as well.
> 
> Cheers
> 
> Paul
> 
> On 19 October 2015 at 21:13, Steve Kargl
>  wrote:
> > 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  
> >
> > 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  
> >
> > PR fortran/68019
> > * gfortran.dg/pr68019.f90: new test.
> >
> > --
> > Steve
> 
> 
> 
> -- 
> Outside of a dog, a book is a man's best friend. Inside of a dog it's
> too dark to read.
> 
> Groucho Marx

-- 
Steve


Re: [PATCH] fortran/68019 -- Remove an assert() that prevents error message

2015-10-19 Thread Paul Richard Thomas
Hi Steve,

Yes, this is OK for trunk. I suggest that it is so obvious that it
should go into 5 branch as well.

Cheers

Paul

On 19 October 2015 at 21:13, Steve Kargl
 wrote:
> 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  
>
> 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  
>
> PR fortran/68019
> * gfortran.dg/pr68019.f90: new test.
>
> --
> Steve



-- 
Outside of a dog, a book is a man's best friend. Inside of a dog it's
too dark to read.

Groucho Marx


[PATCH] fortran/68019 -- Remove an assert() that prevents error message

2015-10-19 Thread Steve Kargl
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  

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  

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", >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