The documentation of __builtin_constant_p is somewhat informal.  It just
says:

 The function
 returns the integer 1 if the argument is known to be a compile-time
 constant and 0 if it is not known to be a compile-time constant.

But what is a compile-time constant?
My gut feeling is that anything that is CONSTANT_P at rtl level should qualify.
But then, fold_builtin_constant_p goes to a lot of trouble to reject
perfectly fine addresses.  Not only the address of the first element
of a character array should be considered constant, but any constant offset
should be fine.

More importantly. addresses that becomes a SYMBOL_REF should be considered
constant.  I.e. In particular, the addresses of variables with static storage.
I have a simple patch to recognize these as constants;
do people agree that this is the right thing to do?

Reply via email to