mirror of git://gcc.gnu.org/git/gcc.git
compiler: Check for initialization loop in constant initializer.
From-SVN: r184347
This commit is contained in:
parent
061793a4cc
commit
7a6cb708b1
|
@ -834,8 +834,15 @@ Gogo::write_globals()
|
||||||
else if (init == NULL_TREE)
|
else if (init == NULL_TREE)
|
||||||
;
|
;
|
||||||
else if (TREE_CONSTANT(init))
|
else if (TREE_CONSTANT(init))
|
||||||
this->backend()->global_variable_set_init(var,
|
{
|
||||||
tree_to_expr(init));
|
if (expression_requires(no->var_value()->init(), NULL, no))
|
||||||
|
error_at(no->location(),
|
||||||
|
"initialization expression for %qs depends "
|
||||||
|
"upon itself",
|
||||||
|
no->message_name().c_str());
|
||||||
|
this->backend()->global_variable_set_init(var,
|
||||||
|
tree_to_expr(init));
|
||||||
|
}
|
||||||
else if (is_sink)
|
else if (is_sink)
|
||||||
var_init_tree = init;
|
var_init_tree = init;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue