This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: ptx preliminary address space fixes [2/4]
- From: Bernd Schmidt <bernds at codesourcery dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 12 Sep 2014 13:17:15 +0200
- Subject: Re: ptx preliminary address space fixes [2/4]
- Authentication-results: sourceware.org; auth=none
- References: <54117576 dot 4000607 at codesourcery dot com> <CAFiYyc2x+EcO-ygeCkXjs-d8mb7nfADVCbP7o2AhDXnbGywqAg at mail dot gmail dot com>
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))
Bernd