public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] fortran/68019 -- Remove an assert() that prevents error message
@ 2015-10-19 19:40 Steve Kargl
  2015-10-19 20:04 ` Paul Richard Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2015-10-19 19:40 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 474 bytes --]

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  <kargl@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  <kargl@gcc.gnu.org>

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

-- 
Steve

[-- Attachment #2: pr68019.diff --]
[-- Type: text/x-diff, Size: 1074 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fortran/68019 -- Remove an assert() that prevents error message
  2015-10-19 19:40 [PATCH] fortran/68019 -- Remove an assert() that prevents error message Steve Kargl
@ 2015-10-19 20:04 ` Paul Richard Thomas
  2015-10-19 21:41   ` Steve Kargl
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Richard Thomas @ 2015-10-19 20:04 UTC (permalink / raw)
  To: Steve Kargl; +Cc: fortran, gcc-patches

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
<sgk@troutmask.apl.washington.edu> 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  <kargl@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  <kargl@gcc.gnu.org>
>
>         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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fortran/68019 -- Remove an assert() that prevents error message
  2015-10-19 20:04 ` Paul Richard Thomas
@ 2015-10-19 21:41   ` Steve Kargl
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Kargl @ 2015-10-19 21:41 UTC (permalink / raw)
  To: Paul Richard Thomas; +Cc: fortran, gcc-patches

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
> <sgk@troutmask.apl.washington.edu> 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  <kargl@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  <kargl@gcc.gnu.org>
> >
> >         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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-19 21:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-19 19:40 [PATCH] fortran/68019 -- Remove an assert() that prevents error message Steve Kargl
2015-10-19 20:04 ` Paul Richard Thomas
2015-10-19 21:41   ` Steve Kargl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).