diff mbox

ptx preliminary address space fixes [2/4]

Message ID 54117576.4000607@codesourcery.com
State New
Headers show

Commit Message

Bernd Schmidt Sept. 11, 2014, 10:12 a.m. UTC
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?


Bernd

Comments

Richard Biener Sept. 11, 2014, 11:30 a.m. UTC | #1
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).

Thanks,
Richard.

>
> Bernd
diff mbox

Patch

commit 6b9be6e3081c313c024aeabe2d70bc0f8146b429
Author: Bernd Schmidt <bernds@codesourcery.com>
Date:   Wed Sep 10 16:32:56 2014 +0200

    	* tree-sra.c (build_ref_for_offset): Use existing address space
    	when replacing a memory reference.

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 8259dba..c69cc90 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1561,6 +1561,7 @@  build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset,
   if (align < TYPE_ALIGN (exp_type))
     exp_type = build_aligned_type (exp_type, align);
 
+  exp_type = apply_as_to_type (exp_type, TYPE_ADDR_SPACE (TREE_TYPE (prev_base)));
   mem_ref = fold_build2_loc (loc, MEM_REF, exp_type, base, off);
   if (TREE_THIS_VOLATILE (prev_base))
     TREE_THIS_VOLATILE (mem_ref) = 1;