* [Patch, Fortran] PR 88047: [9 Regression] ICE in gfc_find_vtab, at fortran/class.c:2843
@ 2019-01-08 9:11 Janus Weil
2019-01-08 15:28 ` Steve Kargl
0 siblings, 1 reply; 3+ messages in thread
From: Janus Weil @ 2019-01-08 9:11 UTC (permalink / raw)
To: gfortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 285 bytes --]
Hi all,
the attached patch is close to obvious and fixes another small
ICE-on-invalid regression. Since there was a bit of discussion in the
PR, I am submitting it for approval instead of just committing as
obvious.
Regtests cleanly on x86_64-linux-gnu. Ok for trunk?
Cheers,
Janus
[-- Attachment #2: pr88047.diff --]
[-- Type: text/x-patch, Size: 2502 bytes --]
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ba95a26e6ae..4d50f880d38 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-08 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/88047
+ * class.c (gfc_find_vtab): For polymorphic typespecs, the components of
+ the class container may not be available (in case of invalid code).
+
2019-01-07 Thomas Koenig <tkoenig@gcc.gnu.org>
Harald Anlauf <anlauf@gmx.de>
Tobias Burnus <burnus@gcc.gnu.org>
diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c
index 77f0fca9385..8809b5b5b6e 100644
--- a/gcc/fortran/class.c
+++ b/gcc/fortran/class.c
@@ -2846,7 +2846,10 @@ gfc_find_vtab (gfc_typespec *ts)
case BT_DERIVED:
return gfc_find_derived_vtab (ts->u.derived);
case BT_CLASS:
- return gfc_find_derived_vtab (ts->u.derived->components->ts.u.derived);
+ if (ts->u.derived->components && ts->u.derived->components->ts.u.derived)
+ return gfc_find_derived_vtab (ts->u.derived->components->ts.u.derived);
+ else
+ return NULL;
default:
return find_intrinsic_vtab (ts);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 23de2ea6f0b..45279ccae0c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-01-08 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/88047
+ * gfortran.dg/class_69.f90: New test case.
+
2019-01-07 David Malcolm <dmalcolm@redhat.com>
PR jit/88747
diff --git a/gcc/testsuite/gfortran.dg/class_69.f90 b/gcc/testsuite/gfortran.dg/class_69.f90
new file mode 100644
index 00000000000..e45e03528b7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_69.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+!
+! PR 88047: [9 Regression] ICE in gfc_find_vtab, at fortran/class.c:2843
+!
+! Contributed by G. Steinmetz <gscfq@t-online.de>
+
+subroutine sub_a
+ type t
+ end type
+ class(t) :: x(2) ! { dg-error "must be dummy, allocatable or pointer" }
+ class(t), parameter :: a(2) = t() ! { dg-error "cannot have the PARAMETER attribute" }
+ x = a ! { dg-error "Nonallocatable variable must not be polymorphic in intrinsic assignment" }
+end
+
+subroutine sub_b
+ type t
+ integer :: n
+ end type
+ class(t) :: a, x ! { dg-error "must be dummy, allocatable or pointer" }
+ x = a ! { dg-error "Nonallocatable variable must not be polymorphic in intrinsic assignment" }
+end
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, Fortran] PR 88047: [9 Regression] ICE in gfc_find_vtab, at fortran/class.c:2843
2019-01-08 9:11 [Patch, Fortran] PR 88047: [9 Regression] ICE in gfc_find_vtab, at fortran/class.c:2843 Janus Weil
@ 2019-01-08 15:28 ` Steve Kargl
2019-01-08 19:34 ` Janus Weil
0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2019-01-08 15:28 UTC (permalink / raw)
To: Janus Weil; +Cc: gfortran, gcc-patches
On Tue, Jan 08, 2019 at 10:11:33AM +0100, Janus Weil wrote:
>
> the attached patch is close to obvious and fixes another small
> ICE-on-invalid regression. Since there was a bit of discussion in the
> PR, I am submitting it for approval instead of just committing as
> obvious.
>
> Regtests cleanly on x86_64-linux-gnu. Ok for trunk?
>
OK.
--
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, Fortran] PR 88047: [9 Regression] ICE in gfc_find_vtab, at fortran/class.c:2843
2019-01-08 15:28 ` Steve Kargl
@ 2019-01-08 19:34 ` Janus Weil
0 siblings, 0 replies; 3+ messages in thread
From: Janus Weil @ 2019-01-08 19:34 UTC (permalink / raw)
To: Steve Kargl; +Cc: gfortran, gcc-patches
Am Di., 8. Jan. 2019 um 16:28 Uhr schrieb Steve Kargl
<sgk@troutmask.apl.washington.edu>:
>
> On Tue, Jan 08, 2019 at 10:11:33AM +0100, Janus Weil wrote:
> >
> > the attached patch is close to obvious and fixes another small
> > ICE-on-invalid regression. Since there was a bit of discussion in the
> > PR, I am submitting it for approval instead of just committing as
> > obvious.
> >
> > Regtests cleanly on x86_64-linux-gnu. Ok for trunk?
> >
>
> OK.
Thanks! Committed as r267735.
Cheers,
Janus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-08 19:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08 9:11 [Patch, Fortran] PR 88047: [9 Regression] ICE in gfc_find_vtab, at fortran/class.c:2843 Janus Weil
2019-01-08 15:28 ` Steve Kargl
2019-01-08 19:34 ` Janus Weil
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).