Commit 7c929c9c by Tobias Burnus Committed by Tobias Burnus

Fortran] PR91586 Fix ICE on invalid code with CLASS

        gcc/fortran/
        PR fortran/91586
        * class.c (gfc_find_derived_vtab): Return NULL
        instead of deref'ing NULL pointer.

        gcc/testsuite/
        PR fortran/91586
        * gfortran.dg/class_71.f90: New.

From-SVN: r277153
parent 15abd932
2019-10-18 Tobias Burnus <tobias@codesourcery.com>
PR fortran/91586
* class.c (gfc_find_derived_vtab): Return NULL
instead of deref'ing NULL pointer.
2019-10-15 James Norris <jnorris@codesourcery.com> 2019-10-15 James Norris <jnorris@codesourcery.com>
Tobias Burnus <tobias@codesourcery.com> Tobias Burnus <tobias@codesourcery.com>
......
...@@ -2241,6 +2241,9 @@ gfc_find_derived_vtab (gfc_symbol *derived) ...@@ -2241,6 +2241,9 @@ gfc_find_derived_vtab (gfc_symbol *derived)
if (!derived->attr.unlimited_polymorphic && derived->attr.is_class) if (!derived->attr.unlimited_polymorphic && derived->attr.is_class)
derived = gfc_get_derived_super_type (derived); derived = gfc_get_derived_super_type (derived);
if (!derived)
return NULL;
/* Find the gsymbol for the module of use associated derived types. */ /* Find the gsymbol for the module of use associated derived types. */
if ((derived->attr.use_assoc || derived->attr.used_in_submodule) if ((derived->attr.use_assoc || derived->attr.used_in_submodule)
&& !derived->attr.vtype && !derived->attr.is_class) && !derived->attr.vtype && !derived->attr.is_class)
......
2019-10-18 Tobias Burnus <tobias@codesourcery.com>
PR fortran/91586
* gfortran.dg/class_71.f90: New.
2019-10-18 Georg-Johann Lay <avr@gjlay.de> 2019-10-18 Georg-Johann Lay <avr@gjlay.de>
Fix some fallout for small targets. Fix some fallout for small targets.
......
! { dg-do compile }
!
! PR fortran/91586
!
! Contributed by G. Steinmetz
!
program p
type t
class(*), allocatable :: a
end type
class(t) :: x, y ! { dg-error "must be dummy, allocatable or pointer" }
y = x ! { dg-error "Nonallocatable variable must not be polymorphic in intrinsic assignment" }
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment