diff options
author | hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-23 16:18:49 +0000 |
---|---|---|
committer | hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-23 16:18:49 +0000 |
commit | 150edb0704ca198f9f9f37ff133ab6210e2ff3ae (patch) | |
tree | 21e2dd58058f99241fdf55ad680c1c3ebc3dd2e5 /gcc/testsuite/gnat.dg | |
parent | 457556f88e31daea3fe57e4bdf751528438331ac (diff) | |
download | gcc-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/gnat.dg')
-rw-r--r-- | gcc/testsuite/gnat.dg/varsize_temp.adb | 29 |
1 files changed, 29 insertions, 0 deletions
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; + + |