This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: your change to tree-sra.c
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: rth at redhat dot com
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 7 Jul 04 12:33:52 EDT
- Subject: Re: your change to tree-sra.c
DECL_INITIAL being NULL has *always* meant that the variable goes
in BSS, and thus is zero initialized. We're talking about loading
from static, read-only memory. There must be *SOME* value there,
and by definition it cannot change.
That's why I raised the question about the meaning of TREE_READONLY.
See your answer at http://gcc.gnu.org/ml/gcc/2004-07/msg00195.html
This is a case where the optimizer *does* use it.
You've not yet explained to me what is wrong with assuming zero from
null DECL_INITIAL. How about you start there?
OK.
For automatic variables, we always emit the code to explicitly initialize
a VAR_DECL and then clear DECL_INITIAL.
For statics, if initializer_constant_valid_p is not set, we can't initialize
it load time. So the Ada front end, by analogy with locals, emits the
initialization code into a elaboration procedure and clears DECL_INITIAL.
This was the issue for my query about TREE_READONLY. If it literally means
that a decl isn't written, then we have to clear it when taking something
from DECL_INITIAL and emitting code for it. But if it's like RTX_UNCHANGING_P
where we're allowed to set it *once*, we can leave it set.