From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [PATCH] fortran/68019 -- Remove an assert() that prevents error message
Date: Mon, 19 Oct 2015 19:40:00 -0000 [thread overview]
Message-ID: <20151019191326.GA95651@troutmask.apl.washington.edu> (raw)
[-- 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
next reply other threads:[~2015-10-19 19:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-19 19:40 Steve Kargl [this message]
2015-10-19 20:04 ` Paul Richard Thomas
2015-10-19 21:41 ` Steve Kargl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151019191326.GA95651@troutmask.apl.washington.edu \
--to=sgk@troutmask.apl.washington.edu \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).