User account creation filtered due to spam.

View | Details | Raw Unified | Return to bug 50410
Collapse All | Expand All

(-)a/gcc/fortran/data.c (+7 lines)
Lines 212-217 gfc_assign_data_value (gfc_expr *lvalue, gfc_expr *rvalue, mpz_t index, Link Here
212
  last_con = NULL;
212
  last_con = NULL;
213
  mpz_init_set_si (offset, 0);
213
  mpz_init_set_si (offset, 0);
214
214
215
  if (gfc_expr_attr (lvalue).pointer && rvalue->expr_type != EXPR_NULL)
216
    {
217
      gfc_error ("NULL() initialization expected in DATA statement for '%s' "
218
	         "at %L", symbol->name, &rvalue->where);
219
      return FAILURE;
220
    }
221
215
  /* Find/create the parent expressions for subobject references.  */
222
  /* Find/create the parent expressions for subobject references.  */
216
  for (ref = lvalue->ref; ref; ref = ref->next)
223
  for (ref = lvalue->ref; ref; ref = ref->next)
217
    {
224
    {
(-)a/gcc/fortran/decl.c (+25 lines)
Lines 237-242 var_element (gfc_data_variable *new_var) Link Here
237
{
237
{
238
  match m;
238
  match m;
239
  gfc_symbol *sym;
239
  gfc_symbol *sym;
240
  gfc_ref *ref;
240
241
241
  memset (new_var, 0, sizeof (gfc_data_variable));
242
  memset (new_var, 0, sizeof (gfc_data_variable));
242
243
Lines 269-274 var_element (gfc_data_variable *new_var) Link Here
269
			 sym->name) == FAILURE)
270
			 sym->name) == FAILURE)
270
    return MATCH_ERROR;
271
    return MATCH_ERROR;
271
272
273
  if (!sym->attr.data && sym->value)
274
    {
275
      gfc_error ("Symbol variable '%s' is already initalized and may thus not "
276
		 "be in a DATA statement at %C", sym->name);
277
      return MATCH_ERROR;
278
    }
279
280
  for (ref = new_var->expr->ref; ref; ref = ref->next)
281
    if (ref->type == REF_COMPONENT
282
	&& (ref->u.c.sym->attr.pointer
283
	    || ref->u.c.sym->attr.allocatable))
284
      break;
285
286
  /* Reject DATA initialization of an allocatable or pointer, but allow a
287
     pointer last for null() initialization.  */
288
  if (sym->attr.allocatable || (sym->attr.pointer && new_var->expr->ref)
289
      || (ref && ref->next) || (ref && ref->u.c.sym->attr.allocatable))
290
    {
291
      gfc_error ("Cannot initialize object '%s' with allocatable or "
292
		 "pointer in the DATA statement at %C",
293
		 ref ? ref->u.c.sym->name : sym->name);
294
      return MATCH_ERROR;
295
    }
296
272
  if (gfc_add_data (&sym->attr, sym->name, &new_var->expr->where) == FAILURE)
297
  if (gfc_add_data (&sym->attr, sym->name, &new_var->expr->where) == FAILURE)
273
    return MATCH_ERROR;
298
    return MATCH_ERROR;
274
299

Return to bug 50410