Fortran: avoid NULL pointer dereference on bad EQUIVALENCEs [PR107559]
gcc/fortran/ChangeLog: PR fortran/107559 * resolve.cc (resolve_equivalence): Avoid NULL pointer dereference while emitting diagnostics for bad EQUIVALENCEs. gcc/testsuite/ChangeLog: PR fortran/107559 * gfortran.dg/pr107559.f90: New test.
This commit is contained in:
parent
f94c2eff6b
commit
e505f7493b
2 changed files with 13 additions and 0 deletions
|
@ -17218,6 +17218,7 @@ resolve_equivalence (gfc_equiv *eq)
|
|||
"statement at %L with different type objects";
|
||||
if ((object ==2
|
||||
&& last_eq_type == SEQ_MIXED
|
||||
&& last_where
|
||||
&& !gfc_notify_std (GFC_STD_GNU, msg, first_sym->name, last_where))
|
||||
|| (eq_type == SEQ_MIXED
|
||||
&& !gfc_notify_std (GFC_STD_GNU, msg, sym->name, &e->where)))
|
||||
|
@ -17227,6 +17228,7 @@ resolve_equivalence (gfc_equiv *eq)
|
|||
"statement at %L with objects of different type";
|
||||
if ((object ==2
|
||||
&& last_eq_type == SEQ_NONDEFAULT
|
||||
&& last_where
|
||||
&& !gfc_notify_std (GFC_STD_GNU, msg, first_sym->name, last_where))
|
||||
|| (eq_type == SEQ_NONDEFAULT
|
||||
&& !gfc_notify_std (GFC_STD_GNU, msg, sym->name, &e->where)))
|
||||
|
|
11
gcc/testsuite/gfortran.dg/pr107559.f90
Normal file
11
gcc/testsuite/gfortran.dg/pr107559.f90
Normal file
|
@ -0,0 +1,11 @@
|
|||
! { dg-do compile }
|
||||
! { dg-options "-std=f95" }
|
||||
! PR fortran/107559 - ICE in resolve_equivalence
|
||||
! Contributed by G.Steinmetz
|
||||
|
||||
module m
|
||||
implicit none
|
||||
integer, protected :: a ! { dg-error "Fortran 2003: PROTECTED attribute" }
|
||||
integer :: b
|
||||
equivalence (a, b) ! { dg-error "has no IMPLICIT type" }
|
||||
end
|
Loading…
Add table
Reference in a new issue