* tree-sra.c (build_ref_for_offset): Strip useless type conversions
from the address built for a reference with variable offset.
From-SVN: r171393
+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
+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
--- /dev/null
+-- { 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;
--- /dev/null
+package Array15 is
+
+ function F (I : Integer) return Integer;
+
+end Array15;
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;