Message ID | 5412D63B.8090002@codesourcery.com |
---|---|
State | New |
Headers | show |
On Fri, Sep 12, 2014 at 1:17 PM, Bernd Schmidt <bernds@codesourcery.com> wrote: > On 09/11/2014 01:30 PM, Richard Biener wrote: >> >> On Thu, Sep 11, 2014 at 12:12 PM, Bernd Schmidt <bernds@codesourcery.com> >> wrote: >>> >>> This is a bug in SRA which replaces a memory reference without taking >>> care >>> to use the correct address space. >>> >>> Bootstrapped and tested together with the other patches on x86_64-linux. >>> Ok? >> >> >> Ok (with adjustments necessary for renaming apply_as_to_type). > > > How about this variant with a suitable reference_apply_addr_space? > > Index: gcc/tree-sra.c > =================================================================== > --- gcc/tree-sra.c.orig > +++ gcc/tree-sra.c > @@ -1562,6 +1562,8 @@ build_ref_for_offset (location_t loc, tr > exp_type = build_aligned_type (exp_type, align); > > mem_ref = fold_build2_loc (loc, MEM_REF, exp_type, base, off); > + reference_apply_addr_space (mem_ref, > + TYPE_ADDR_SPACE (TREE_TYPE (prev_base)); > if (TREE_THIS_VOLATILE (prev_base)) > TREE_THIS_VOLATILE (mem_ref) = 1; > if (TREE_SIDE_EFFECTS (prev_base)) Ok with using reference_addr_space (prev_base). Thanks, Richard. > > Bernd
Index: gcc/tree-sra.c =================================================================== --- gcc/tree-sra.c.orig +++ gcc/tree-sra.c @@ -1562,6 +1562,8 @@ build_ref_for_offset (location_t loc, tr exp_type = build_aligned_type (exp_type, align); mem_ref = fold_build2_loc (loc, MEM_REF, exp_type, base, off); + reference_apply_addr_space (mem_ref, + TYPE_ADDR_SPACE (TREE_TYPE (prev_base)); if (TREE_THIS_VOLATILE (prev_base)) TREE_THIS_VOLATILE (mem_ref) = 1; if (TREE_SIDE_EFFECTS (prev_base))