* trans-expr.c (gfc_conv_initializer): Set STATIC flags for initializers.
From-SVN: r163973
This commit is contained in:
parent
f27e50db1a
commit
fa9a71936a
|
@ -1,3 +1,7 @@
|
||||||
|
2010-09-07 Jan Hubicka <jh@suse.cz>
|
||||||
|
|
||||||
|
* trans-expr.c (gfc_conv_initializer): Set STATIC flags for initializers.
|
||||||
|
|
||||||
2010-09-07 Tobias Burnus <burnus@net-b.de>
|
2010-09-07 Tobias Burnus <burnus@net-b.de>
|
||||||
|
|
||||||
PR fortran/45583
|
PR fortran/45583
|
||||||
|
|
|
@ -4000,19 +4000,23 @@ gfc_conv_initializer (gfc_expr * expr, gfc_typespec * ts, tree type,
|
||||||
|
|
||||||
gfc_init_se (&se, NULL);
|
gfc_init_se (&se, NULL);
|
||||||
gfc_conv_constant (&se, expr);
|
gfc_conv_constant (&se, expr);
|
||||||
|
gcc_assert (TREE_CODE (se.expr) != CONSTRUCTOR);
|
||||||
return se.expr;
|
return se.expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array && !procptr)
|
if (array && !procptr)
|
||||||
{
|
{
|
||||||
|
tree ctor;
|
||||||
/* Arrays need special handling. */
|
/* Arrays need special handling. */
|
||||||
if (pointer)
|
if (pointer)
|
||||||
return gfc_build_null_descriptor (type);
|
ctor = gfc_build_null_descriptor (type);
|
||||||
/* Special case assigning an array to zero. */
|
/* Special case assigning an array to zero. */
|
||||||
else if (is_zero_initializer_p (expr))
|
else if (is_zero_initializer_p (expr))
|
||||||
return build_constructor (type, NULL);
|
ctor = build_constructor (type, NULL);
|
||||||
else
|
else
|
||||||
return gfc_conv_array_initializer (type, expr);
|
ctor = gfc_conv_array_initializer (type, expr);
|
||||||
|
TREE_STATIC (ctor) = 1;
|
||||||
|
return ctor;
|
||||||
}
|
}
|
||||||
else if (pointer || procptr)
|
else if (pointer || procptr)
|
||||||
{
|
{
|
||||||
|
@ -4023,6 +4027,7 @@ gfc_conv_initializer (gfc_expr * expr, gfc_typespec * ts, tree type,
|
||||||
gfc_init_se (&se, NULL);
|
gfc_init_se (&se, NULL);
|
||||||
se.want_pointer = 1;
|
se.want_pointer = 1;
|
||||||
gfc_conv_expr (&se, expr);
|
gfc_conv_expr (&se, expr);
|
||||||
|
gcc_assert (TREE_CODE (se.expr) != CONSTRUCTOR);
|
||||||
return se.expr;
|
return se.expr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4037,14 +4042,21 @@ gfc_conv_initializer (gfc_expr * expr, gfc_typespec * ts, tree type,
|
||||||
gfc_conv_structure (&se, gfc_class_null_initializer(ts), 1);
|
gfc_conv_structure (&se, gfc_class_null_initializer(ts), 1);
|
||||||
else
|
else
|
||||||
gfc_conv_structure (&se, expr, 1);
|
gfc_conv_structure (&se, expr, 1);
|
||||||
|
gcc_assert (TREE_CODE (se.expr) == CONSTRUCTOR);
|
||||||
|
TREE_STATIC (se.expr) = 1;
|
||||||
return se.expr;
|
return se.expr;
|
||||||
|
|
||||||
case BT_CHARACTER:
|
case BT_CHARACTER:
|
||||||
return gfc_conv_string_init (ts->u.cl->backend_decl,expr);
|
{
|
||||||
|
tree ctor = gfc_conv_string_init (ts->u.cl->backend_decl,expr);
|
||||||
|
TREE_STATIC (ctor) = 1;
|
||||||
|
return ctor;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
gfc_init_se (&se, NULL);
|
gfc_init_se (&se, NULL);
|
||||||
gfc_conv_constant (&se, expr);
|
gfc_conv_constant (&se, expr);
|
||||||
|
gcc_assert (TREE_CODE (se.expr) != CONSTRUCTOR);
|
||||||
return se.expr;
|
return se.expr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue