This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Questions about a constant array reference in the C++ front end


Hi Nathan,

> this is untrue. the elements hold the qualification.

Then how do I know that an array is declared with const (or static
const)?  When I looked at the CONSTRUCTOR stored in the DECL_INITIAL
of an array, I saw it with the TREE_STATIC flag set regardless of
whether the array is declared with const, so that's not useful to
determine whether the array is declared with const.

All I need is a sufficient condition that works with C, C++, and any
other language that GCC supports to determine whether it's safe to
fold array[CST] into a constant.

> Incorrect.  RANGE_EXPRs get generated during processing of an array's
> initializer -- very early on in the C++ FE.

Do you know how to trigger a RANGE_EXPR?  I see that in
build_zero_init, so I tried a big array with only zeros in it, but
that didn't help.

Kazu Hirata


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]