On Wed, Jun 20, 2012 at 5:09 PM, Michael Matz <[email protected]> wrote:
> Hi,
>
> On Wed, 20 Jun 2012, Richard Guenther wrote:
>
>> > + exp = fold_build2 (MEM_REF,
>> > + build_array_type (char_type_node,
>> > + build_range_type (sizetype,
>> > + size_one_node,
>> > len)),
>> > + exp, build_int_cst (ptr_type_node, 0));
>> > +
>> > + /* If the MEM_REF has no acceptable address, try to get the base object,
>> > + and build an all-aliasing unknown-sized access to that one. */
>> > + if (!is_gimple_mem_ref_addr (TREE_OPERAND (exp, 0))
>> > + && (exp = get_base_address (exp)))
>>
>> The get_base_address massaging should be not necessary if you'd
>> use the original exp here, not the built MEM_REF.
>
> Hmm? The original expression is an address, I have to build a MEM_REF out
> of that, and the is_gimple_mem_ref_addr() just checked that that very
> address (after going through fold) is not acceptable as MEM_REF operand.
> So how could I avoid the massaging of the address to make it an acceptable
> operand?
Not change get_base_addres and use
if (!is_gimple_mem_ref_addr (TREE_OPERAND (exp, 0))
&& (exp = get_base_address (TREE_OPERAND (orig_exp, 0))))
Richard.