* tree-sra.c (bitfield_overlaps_p): Fix oversight.

From-SVN: r141556
This commit is contained in:
Eric Botcazou 2008-11-03 19:55:54 +00:00 committed by Eric Botcazou
parent e73da78efc
commit 2d8d91a840
4 changed files with 47 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2008-11-03 Eric Botcazou <ebotcazou@adacore.com>
* tree-sra.c (bitfield_overlaps_p): Fix oversight.
2008-11-03 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
PR other/37463

View File

@ -1,3 +1,7 @@
2008-11-03 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/array5.adb New test.
2008-11-03 Richard Guenther <rguenther@suse.de>
Jakub Jelinek <jakub@redhat.com>

View File

@ -0,0 +1,34 @@
-- { dg-do run }
-- { dg-options "-O" }
procedure Array5 is
type myint is range 0 .. 100_000;
Bla : constant myint := 359;
type my_array is array (1 .. 2) of myint;
type item is record
Length : Integer;
Content : my_array;
end record;
procedure create_item (M : out item) is
begin
M.Length := 1;
M.Content := (others => Bla);
end;
Var : item;
begin
create_item (Var);
if Var.Length = 1
and then Var.Content (1) = Bla
then
null;
else
raise Program_Error;
end if;
end;

View File

@ -2961,8 +2961,13 @@ bitfield_overlaps_p (tree blen, tree bpos, struct sra_elt *fld,
}
else if (TREE_CODE (fld->element) == INTEGER_CST)
{
tree domain_type = TYPE_DOMAIN (TREE_TYPE (fld->parent->element));
flen = fold_convert (bitsizetype, TYPE_SIZE (fld->type));
fpos = fold_convert (bitsizetype, fld->element);
if (domain_type && TYPE_MIN_VALUE (domain_type))
fpos = size_binop (MINUS_EXPR, fpos,
fold_convert (bitsizetype,
TYPE_MIN_VALUE (domain_type)));
fpos = size_binop (MULT_EXPR, flen, fpos);
}
else