PR fortran/124807
gcc/fortran/ChangeLog:
* decl.cc (add_init_expr_to_sym): Suggested by Coverity:
Check sym->as != NULL before dereferencing it.
/* If sym is implied-shape, set its upper bounds from init. */
if (sym->attr.flavor == FL_PARAMETER && sym->attr.dimension
- && sym->as->type == AS_IMPLIED_SHAPE)
+ && sym->as && sym->as->type == AS_IMPLIED_SHAPE)
{
int dim;
/* Ensure that explicit bounds are simplified. */
if (sym->attr.flavor == FL_PARAMETER && sym->attr.dimension
- && sym->as->type == AS_EXPLICIT)
+ && sym->as && sym->as->type == AS_EXPLICIT)
{
for (int dim = 0; dim < sym->as->rank; ++dim)
{