mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-04 23:51:47 +08:00
Fortran: error recovery after reference to bad CLASS variable [PR107681]
gcc/fortran/ChangeLog: PR fortran/107681 * resolve.cc (resolve_fl_var_and_proc): Prevent NULL pointer dereference with reference to bad CLASS variable. gcc/testsuite/ChangeLog: PR fortran/107681 * gfortran.dg/pr107681.f90: New test.
This commit is contained in:
parent
713dcfc85e
commit
96e4244ef3
@ -12967,6 +12967,7 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
|
||||
&& sym->ts.u.derived
|
||||
&& !sym->attr.select_type_temporary
|
||||
&& !UNLIMITED_POLY (sym)
|
||||
&& CLASS_DATA (sym)->ts.u.derived
|
||||
&& !gfc_type_is_extensible (CLASS_DATA (sym)->ts.u.derived))
|
||||
{
|
||||
gfc_error ("Type %qs of CLASS variable %qs at %L is not extensible",
|
||||
|
13
gcc/testsuite/gfortran.dg/pr107681.f90
Normal file
13
gcc/testsuite/gfortran.dg/pr107681.f90
Normal file
@ -0,0 +1,13 @@
|
||||
! { dg-do compile }
|
||||
! { dg-options "-fcoarray=lib" }
|
||||
! PR fortran/107681 - ICE in gfc_type_is_extensible
|
||||
! Contributed by G.Steinmetz
|
||||
|
||||
program p
|
||||
type t
|
||||
integer, allocatable :: a
|
||||
end type
|
||||
class(t) :: x[*] ! { dg-error "must be dummy, allocatable or pointer" }
|
||||
associate (y => x) ! { dg-error "Invalid array reference" }
|
||||
end associate
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user