This is the mail archive of the gcc-patches@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: [RFA] Do not emit &a for &a[0] in the C frontend


On 5/17/05, Richard Henderson <rth@redhat.com> wrote:
> On Tue, May 17, 2005 at 04:35:21PM +0200, Richard Guenther wrote:
> > !       adr = build_unary_op (ADDR_EXPR,
> > !                         build4 (ARRAY_REF, restype,
> > !                                 exp, integer_zero_node,
> > !                                 NULL_TREE, NULL_TREE), 1);
> > !       if (!c_mark_addressable (exp))
> > !     return error_mark_node;
> 
> Doesn't build_unary_op take care of the c_mark_addressable for you?

Not in all paths - it does some optimization, namely marking
COMPOUND_LITERAL_EXPR as TREE_CONSTANT which is why
I am using it instead of building the addr expr manually.

But yes, I guess in all cases that can happen if I feed it an ARRAY_REF
it does so.  And I see there is another chunk of code that decomposes
ARRAY_REF to pointer arithmetic - ugh.

I'll update the patch but was merely looking for input to the general
task on avoiding creating &a.

Thanks,
Richard.


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