I have the impression that Gerhard is a hydra: one PR down, he submits two new ones... :-( Anyway, here's a straightforward fix for a NULL pointer dereference for an invalid argument to STAT. For an alternative patch by Steve see PR. Regtested on x86_64-pc-linux-gnu. OK for mainline / 11-branch when it reopens? Thanks, Harald Fortran: ICE in resolve_allocate_deallocate for invalid STAT argument gcc/fortran/ChangeLog: PR fortran/101564 * resolve.c (resolve_allocate_deallocate): Avoid NULL pointer dereference and shortcut for bad STAT argument to (DE)ALLOCATE. gcc/testsuite/ChangeLog: PR fortran/101564 * gfortran.dg/pr101564.f90: New test.