PR fortran/93423 - ICE on invalid with argument list for module procedure
When recovering from an error, a NULL pointer dereference could occur. Check for that situation and punt. gcc/fortran/ PR fortran/93423 * resolve.c (resolve_symbol): Avoid NULL pointer dereference.
This commit is contained in:
parent
d9fb6f2b4f
commit
b88744905a
@ -15918,7 +15918,7 @@ resolve_symbol (gfc_symbol *sym)
|
|||||||
if (formal)
|
if (formal)
|
||||||
{
|
{
|
||||||
sym->formal_ns = formal->sym->ns;
|
sym->formal_ns = formal->sym->ns;
|
||||||
if (sym->ns != formal->sym->ns)
|
if (sym->formal_ns && sym->ns != formal->sym->ns)
|
||||||
sym->formal_ns->refs++;
|
sym->formal_ns->refs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
gcc/testsuite/gfortran.dg/pr93423.f90
Normal file
21
gcc/testsuite/gfortran.dg/pr93423.f90
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
! { dg-do compile }
|
||||||
|
! PR fortran/93423 - ICE on invalid with argument list for module procedure
|
||||||
|
|
||||||
|
module t
|
||||||
|
type :: b
|
||||||
|
contains
|
||||||
|
procedure :: p => bp
|
||||||
|
end type b
|
||||||
|
interface
|
||||||
|
module function bp(s)
|
||||||
|
class(b), intent(inout) :: s
|
||||||
|
integer, pointer :: bp
|
||||||
|
end function
|
||||||
|
end interface
|
||||||
|
end module t
|
||||||
|
|
||||||
|
submodule (t) ts
|
||||||
|
contains
|
||||||
|
module procedure bp(s) ! { dg-error "must be in a generic module interface" }
|
||||||
|
end procedure bp ! { dg-error "Expecting END SUBMODULE statement" }
|
||||||
|
end submodule ts
|
Loading…
Reference in New Issue
Block a user