summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-28 19:14:05 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-28 19:14:05 +0000
commit18272fb7ac6453e34ec1cea13d0959be29e9d02b (patch)
treee5a12015f5fb2fc6d895eb7184401578c20e3db6 /gcc
parent4dc3c65527a21a6aa25263c7e49ca12153b663f9 (diff)
downloadgcc-18272fb7ac6453e34ec1cea13d0959be29e9d02b.tar.gz
* gimplify.c (gimplify_init_ctor_preeval): Call maybe_with_size_expr
on the element before gimplifying it, instead of punting if it is of variable size. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117288 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimplify.c5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/self_aggregate_with_pointer.adb26
4 files changed, 38 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1044cc057de..779868b015f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-09-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimplify.c (gimplify_init_ctor_preeval): Call maybe_with_size_expr
+ on the element before gimplifying it, instead of punting if it is of
+ variable size.
+
2006-09-28 Zdenek Dvorak <dvorakz@suse.cz>
* doc/loop.texi: New file.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index a408c01ae3a..9db673a62d9 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -2670,9 +2670,8 @@ gimplify_init_ctor_preeval (tree *expr_p, tree *pre_p, tree *post_p,
return;
}
- /* We can't preevaluate if the type contains a placeholder. */
- if (type_contains_placeholder_p (TREE_TYPE (*expr_p)))
- return;
+ /* If this is a variable sized type, we must remember the size. */
+ maybe_with_size_expr (expr_p);
/* Gimplify the constructor element to something appropriate for the rhs
of a MODIFY_EXPR. Given that we know the lhs is an aggregate, we know
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 715e252dc6b..112f6fe64a1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2006-09-28 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/self_aggregate_with_pointer.adb: New test.
+
2006-09-27 Steven G. Kargl <kargls@gcc.gnu.org>
PR fortran/28276
diff --git a/gcc/testsuite/gnat.dg/self_aggregate_with_pointer.adb b/gcc/testsuite/gnat.dg/self_aggregate_with_pointer.adb
new file mode 100644
index 00000000000..179fe4e9722
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/self_aggregate_with_pointer.adb
@@ -0,0 +1,26 @@
+-- { dg-do run }
+
+procedure self_aggregate_with_pointer is
+
+ type Arr is array (Natural range <>) of Integer;
+
+ type Rec (N : Natural) is record
+ A : Arr (1..N);
+ end record;
+
+ type Acc_Rec is access all Rec;
+
+ type SRec is record
+ A : Acc_Rec;
+ I1, I2, I3, I4, I5, I6, I7: Integer;
+ end record;
+
+ R : aliased Rec (1);
+ S : Srec := (A => R'Access, others => 0);
+
+begin
+ S := (A => S.A, others => 0);
+ if S.A /= R'Access then
+ raise Program_Error;
+ end if;
+end;