CLASS(), PARAMETER is not yet properly implemented in gfortran. Using it
in declarations could lead to subsequent NULL pointer dereferences during
checking or simplification of expressions involving those CLASS variables.
gcc/fortran/ChangeLog:
PR fortran/103137
PR fortran/103138
* check.c (gfc_check_shape): Avoid NULL pointer dereference on
missing ref.
* simplify.c (gfc_simplify_cshift): Avoid NULL pointer dereference
when shape not set.
(gfc_simplify_transpose): Likewise.
if (source->rank == 0 || source->expr_type != EXPR_VARIABLE)
return true;
+ if (source->ref == NULL)
+ return false;
+
ar = gfc_find_array_ref (source);
if (ar->as && ar->as->type == AS_ASSUMED_SIZE && ar->type == AR_FULL)
else
which = 0;
+ if (array->shape == NULL)
+ return NULL;
+
gfc_array_size (array, &size);
arraysize = mpz_get_ui (size);
mpz_clear (size);
gcc_assert (matrix->rank == 2);
+ if (matrix->shape == NULL)
+ return NULL;
+
result = gfc_get_array_expr (matrix->ts.type, matrix->ts.kind,
&matrix->where);
result->rank = 2;