Commit a1aa1701 by Eric Botcazou Committed by Eric Botcazou

tree-sra.c (build_ref_for_offset_1): Skip fields without size or with size that…

tree-sra.c (build_ref_for_offset_1): Skip fields without size or with size that can't be represented as a host integer.

	* tree-sra.c (build_ref_for_offset_1) <RECORD_TYPE>: Skip fields
	without size or with size that can't be represented as a host integer.

From-SVN: r153008
parent 717f4048
2009-10-20 Eric Botcazou <ebotcazou@adacore.com>
* tree-sra.c (build_ref_for_offset_1) <RECORD_TYPE>: Skip fields
without size or with size that can't be represented as a host integer.
2009-10-20 Alexandre Oliva <aoliva@redhat.com>
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Don't regard
2009-10-20 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/discr21.ad[sb]: New test.
* gnat.dg/discr21_pkg.ads: New helper.
2009-10-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/41706
......
-- { dg-do compile }
-- { dg-options "-gnatws -O3" }
with Discr21_Pkg; use Discr21_Pkg;
package body Discr21 is
type Index is new Natural range 0 .. 100;
type Arr is array (Index range <> ) of Position;
type Rec(Size : Index := 1) is record
A : Arr(1 .. Size);
end record;
Data : Rec;
function To_V(pos : Position) return VPosition is
begin
return To_Position(pos.x, pos.y, pos.z);
end;
procedure Read(Data : Rec) is
pos : VPosition := To_V (Data.A(1));
begin
null;
end;
procedure Test is
begin
Read (Data);
end;
end Discr21;
package Discr21 is
procedure Test;
end Discr21;
package Discr21_Pkg is
type Position is record
x,y,z : Float;
end record;
type Dim is (Two, Three);
type VPosition (D: Dim := Three) is record
x, y : Float;
case D is
when Two => null;
when Three => z : Float;
end case;
end record;
function To_Position (x, y, z : Float) return VPosition;
end Discr21_Pkg;
......@@ -1243,7 +1243,10 @@ build_ref_for_offset_1 (tree *res, tree type, HOST_WIDE_INT offset,
pos = int_bit_position (fld);
gcc_assert (TREE_CODE (type) == RECORD_TYPE || pos == 0);
size = tree_low_cst (DECL_SIZE (fld), 1);
tr_size = DECL_SIZE (fld);
if (!tr_size || !host_integerp (tr_size, 1))
continue;
size = tree_low_cst (tr_size, 1);
if (pos > offset || (pos + size) <= offset)
continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment