* [PATCH,committed] Fix PR fortran/78814
@ 2017-11-09 19:10 Steve Kargl
0 siblings, 0 replies; only message in thread
From: Steve Kargl @ 2017-11-09 19:10 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 394 bytes --]
Here's another small, obvious fix where a pointer was not
to see that it was non-NULL. Committed after regression
testing on x86_64-*-freebsd.
2017-11-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/78814
* interface.c (symbol_rank): Check for NULL pointer.
2017-11-09 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/78814
* gfortran.dg/interface_40.f90: New testcase.
--
Steve
[-- Attachment #2: interface.diff --]
[-- Type: text/x-diff, Size: 1058 bytes --]
Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c (revision 254554)
+++ gcc/fortran/interface.c (working copy)
@@ -1262,8 +1262,13 @@ generic_correspondence (gfc_formal_arglist *f1, gfc_fo
static int
symbol_rank (gfc_symbol *sym)
{
- gfc_array_spec *as;
- as = (sym->ts.type == BT_CLASS) ? CLASS_DATA (sym)->as : sym->as;
+ gfc_array_spec *as = NULL;
+
+ if (sym->ts.type == BT_CLASS && CLASS_DATA (sym) && CLASS_DATA (sym)->as)
+ as = CLASS_DATA (sym)->as;
+ else
+ as = sym->as;
+
return as ? as->rank : 0;
}
Index: gcc/testsuite/gfortran.dg/interface_40.f90
===================================================================
--- gcc/testsuite/gfortran.dg/interface_40.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/interface_40.f90 (working copy)
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/78814
+! Code contributed by Gerhard Steinmetz
+program p
+ class(*) :: x ! { dg-error " must be dummy, allocatable or pointer" }
+ print *, f(x)
+end
+
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-09 18:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09 19:10 [PATCH,committed] Fix PR fortran/78814 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).