* [patch, fortran] Fix PR 79795
@ 2017-10-15 18:09 Thomas Koenig
2017-10-18 1:11 ` Jerry DeLisle
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Koenig @ 2017-10-15 18:09 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 521 bytes --]
Hello world,
the attached patch fixes a regression by turning an ICE-on-invalid into
an error message (and making sure that it fits).
Regression-tested on trunk.
OK for all affected branches (8/7/6)?
Regards
Thomas
2017-10-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/79795
* resolve.c (resovle_symbol): Change gcc_assert to
sensible error message.
2017-10-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/79795
* gfortran.dg/assumed_size_2.f90: New test.
[-- Attachment #2: p4.diff --]
[-- Type: text/x-patch, Size: 847 bytes --]
Index: resolve.c
===================================================================
--- resolve.c (Revision 253768)
+++ resolve.c (Arbeitskopie)
@@ -14403,7 +14403,23 @@ resolve_symbol (gfc_symbol *sym)
if (as)
{
- gcc_assert (as->type != AS_IMPLIED_SHAPE);
+ /* If AS_IMPLIED_SHAPE makes it to here, it must be a bad
+ specification expression. */
+ if (as->type == AS_IMPLIED_SHAPE)
+ {
+ int i;
+ for (i=0; i<as->rank; i++)
+ {
+ if (as->lower[i] != NULL && as->upper[i] == NULL)
+ {
+ gfc_error ("Bad specification for assumed size array at %L",
+ &as->lower[i]->where);
+ return;
+ }
+ }
+ gcc_unreachable();
+ }
+
if (((as->type == AS_ASSUMED_SIZE && !as->cp_was_assumed)
|| as->type == AS_ASSUMED_SHAPE)
&& !sym->attr.dummy && !sym->attr.select_type_temporary)
[-- Attachment #3: assumed_size_2.f90 --]
[-- Type: text/x-fortran, Size: 120 bytes --]
! { dg-do compile }
subroutine foo(a)
dimension a(*,*) ! { dg-error "Bad specification for assumed size array" }
end
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-18 1:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-15 18:09 [patch, fortran] Fix PR 79795 Thomas Koenig
2017-10-18 1:11 ` Jerry DeLisle
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).