Questions about a constant array reference in the C++ front end
Kazu Hirata
kazu@cs.umass.edu
Tue May 10 06:59:00 GMT 2005
Hi Mark,
> That's a bug, or, rather, a place where the C++ front-end is failing
> to give full information to the optimizer. It should be
> TREE_READONLY. There are some tricky bits, in that if we're doing a
> dynamic initialization, we presently cannot mark it TREE_READONLY,
> but this is a static initialization, so it should be fine. Isn't
> TREE_OPERAND (T, 0) the VAR_DECL for array itself?
Yes, if T is an ARRAY_REF, TREE_OPERAND (T, 0) is the VAR_DECL for the
array itself.
> If so, waht's probably going wrong is that it's not being marked
> TREE_READONLY because we're afraid of the dynamic initialization
> case. We're missing a call to c_apply_quals_to_decl (sp?)
> somewhere.
Thank you for the function name. I might dig into the C++ front end.
Anyway, I filed this "bug" as PR 21454, saying that the contents of a
"completely static" array ends up in the .data section, not the
.rodata. It turned out to be a regression from 3.x.
Kazu Hirata
More information about the Gcc
mailing list