gimplify.c (gimplify_modify_expr_to_memset): Assert our documented assumptions.

2008-06-26  Olivier Hainque  <hainque@adacore.com>

	gcc/
	* gimplify.c (gimplify_modify_expr_to_memset): Assert our
	documented assumptions.

	testsuite/
	* gnat.dg/aligned_vla.adb: New test.

From-SVN: r137171
This commit is contained in:
Olivier Hainque 2008-06-27 07:35:33 +00:00 committed by Olivier Hainque
parent 4b5705609b
commit 1a13360e95
4 changed files with 44 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2008-06-26 Olivier Hainque <hainque@adacore.com>
* gimplify.c (gimplify_modify_expr_to_memset): Assert our
documented assumptions.
2008-06-26 H.J. Lu <hongjiu.lu@intel.com>
* dwarf2out.c: Remove trailing white spaces. Break long line

View File

@ -2809,8 +2809,19 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value)
static enum gimplify_status
gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value)
{
tree t, to, to_ptr;
tree t, from, to, to_ptr;
/* Assert our assumptions, to abort instead of producing wrong code
silently if they are not met. Beware that the RHS CONSTRUCTOR might
not be immediately exposed. */
from = GENERIC_TREE_OPERAND (*expr_p, 1);
if (TREE_CODE (from) == WITH_SIZE_EXPR)
from = TREE_OPERAND (from, 0);
gcc_assert (TREE_CODE (from) == CONSTRUCTOR
&& VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (from)));
/* Now proceed. */
to = GENERIC_TREE_OPERAND (*expr_p, 0);
to_ptr = build_fold_addr_expr (to);

View File

@ -1,3 +1,7 @@
2008-06-27 Olivier Hainque <hainque@adacore.com>
* gnat.dg/aligned_vla.adb: New test.
2008-06-26 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/inline-32.c, gcc.dg/inline-32a.c: New tests.

View File

@ -0,0 +1,23 @@
-- { dg-do run }
procedure Aligned_Vla is
type Table is array (Integer range <>) of Integer;
for Table'Alignment use Long_Float'Alignment;
K : constant := 1;
Konstants : Table (1 .. 4) := (others => K);
procedure Check_Copy (Len : Integer) is
My_Konstants : Table (1 .. Len) := Konstants (1 .. 1 + Len - 1);
begin
for I in My_Konstants'Range loop
if My_Konstants (I) /= K then
raise Program_Error;
end if;
end loop;
end;
begin
Check_Copy (Len => 4);
end;