mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-10 13:31:04 +08:00
tree-sra.c (build_ref_for_offset): Strip useless type conversions from the address built for a reference with...
* tree-sra.c (build_ref_for_offset): Strip useless type conversions from the address built for a reference with variable offset. From-SVN: r171393
This commit is contained in:
parent
c78dd519d3
commit
1d60cc5529
@ -1,3 +1,8 @@
|
||||
2011-03-24 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* tree-sra.c (build_ref_for_offset): Strip useless type conversions
|
||||
from the address built for a reference with variable offset.
|
||||
|
||||
2011-03-24 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR target/48237
|
||||
|
@ -1,3 +1,7 @@
|
||||
2011-03-24 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/array15.ad[sb]: New test.
|
||||
|
||||
2011-03-24 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR target/48237
|
||||
|
24
gcc/testsuite/gnat.dg/array15.adb
Normal file
24
gcc/testsuite/gnat.dg/array15.adb
Normal file
@ -0,0 +1,24 @@
|
||||
-- { dg-do compile }
|
||||
-- { dg-options "-O -gnatws" }
|
||||
|
||||
package body Array15 is
|
||||
|
||||
type Arr is array (Natural range <>) of Integer;
|
||||
|
||||
Table : Arr (1 .. 4);
|
||||
|
||||
N : Natural := 1;
|
||||
|
||||
procedure Zero is
|
||||
begin
|
||||
N := 0;
|
||||
end;
|
||||
|
||||
function F (I : Integer) return Integer is
|
||||
A1 : Arr := (1 => I);
|
||||
A2 : Arr := Table (1 .. N) & A1;
|
||||
begin
|
||||
return A2 (I);
|
||||
end;
|
||||
|
||||
end Array15;
|
5
gcc/testsuite/gnat.dg/array15.ads
Normal file
5
gcc/testsuite/gnat.dg/array15.ads
Normal file
@ -0,0 +1,5 @@
|
||||
package Array15 is
|
||||
|
||||
function F (I : Integer) return Integer;
|
||||
|
||||
end Array15;
|
@ -1376,6 +1376,7 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset,
|
||||
add_referenced_var (tmp);
|
||||
tmp = make_ssa_name (tmp, NULL);
|
||||
addr = build_fold_addr_expr (unshare_expr (prev_base));
|
||||
STRIP_USELESS_TYPE_CONVERSION (addr);
|
||||
stmt = gimple_build_assign (tmp, addr);
|
||||
gimple_set_location (stmt, loc);
|
||||
SSA_NAME_DEF_STMT (tmp) = stmt;
|
||||
|
Loading…
x
Reference in New Issue
Block a user