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: [PATCH] Fix the one entry mem{{,p}cpy,move,set} optimization aliasing issues (PR middle-end/29272)


> where fold_builtin_memory_op only sees &q->t and not &p->ti.t
> the ref_all cast would be removed in some folding, but I haven't
> been able to reproduce something like that, apparently on
> ((struct TI * {ref-all}) &((struct T *) p)->ti)->t = t.ti.t;
> the ref-all cast wasn't folded out.  So, if you think this is
> 100% safe

Yes, my understanding is that 'ref-all' is supposed to stay on the pointer as 
long as the dereference is not optimized out, like 'volatile'.  But, unlike 
'volatile', it won't prevent the dereference from being optimized out.

> then something like the following (as fold_builtin is called even before
> gimplification, I think we can't modify the INDIRECT_REF's operand in-place)
> should work (certainly works on the testcase):

Indeed, you're right.

-- 
Eric Botcazou


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