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

Reply via email to