summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-23 16:18:49 +0000
committerhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-23 16:18:49 +0000
commit150edb0704ca198f9f9f37ff133ab6210e2ff3ae (patch)
tree21e2dd58058f99241fdf55ad680c1c3ebc3dd2e5 /gcc/testsuite
parent457556f88e31daea3fe57e4bdf751528438331ac (diff)
downloadgcc-150edb0704ca198f9f9f37ff133ab6210e2ff3ae.tar.gz
* tree.c (max_int_size_in_bytes): New function, inspired from
code in function.c:assign_temp. * tree.h (max_int_size_in_bytes): Declare. * function.c (assign_temp): Use it. * gimplify.c (create_tmp_var): Relax the assertions on the type properties, not mandating constant size any more. (force_constant_size): New static function. (gimple_add_tmp_var): Use it, forcing variable size to a constant upper bound if it is not constant on entry. * ada/misc.c (gnat_type_max_size): Look at TYPE_ADA_SIZE if we have not been able to get a constant upper bound from TYPE_SIZE_UNIT. * gnat.dg/varsize_temp.adb: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114938 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/varsize_temp.adb29
2 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3b3dc6bac2f..cadfeef986d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2006-06-23 Olivier Hainque <hainque@adacore.com>
+
+ * gnat.dg/varsize_temp.adb: New test.
+
2006-06-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/11468
diff --git a/gcc/testsuite/gnat.dg/varsize_temp.adb b/gcc/testsuite/gnat.dg/varsize_temp.adb
new file mode 100644
index 00000000000..b7c3a0b6039
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/varsize_temp.adb
@@ -0,0 +1,29 @@
+-- { dg-do compile }
+
+procedure Varsize_Temp (Nbytes : Natural) is
+
+ type Message_T (Length : Natural) is record
+ case Length is
+ when 0 => null;
+ when others => Id : Natural;
+ end case;
+ end record;
+
+ type Local_Message_T is new Message_T (Nbytes);
+
+ function One_message return Local_Message_T is
+ M : Local_Message_T;
+ begin
+ if M.Length > 0 then
+ M.Id := 1;
+ end if;
+ return M;
+ end;
+
+ procedure Process (X : Local_Message_T) is begin null; end;
+
+begin
+ Process (One_Message);
+end;
+
+