diff options
author | Olivier Hainque <hainque@adacore.com> | 2006-06-23 16:18:49 +0000 |
---|---|---|
committer | Olivier Hainque <hainque@gcc.gnu.org> | 2006-06-23 16:18:49 +0000 |
commit | a441447f7f6495bb8a8e6d160d7c095da787e708 (patch) | |
tree | 21e2dd58058f99241fdf55ad680c1c3ebc3dd2e5 /gcc/function.c | |
parent | a3d536f1c1c0aa3d414c17c4acc44c900b1f1e38 (diff) | |
download | gcc-a441447f7f6495bb8a8e6d160d7c095da787e708.zip gcc-a441447f7f6495bb8a8e6d160d7c095da787e708.tar.gz gcc-a441447f7f6495bb8a8e6d160d7c095da787e708.tar.bz2 |
tree.c (max_int_size_in_bytes): New function, inspired from code in function.c:assign_temp.
* 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.
From-SVN: r114938
Diffstat (limited to 'gcc/function.c')
-rw-r--r-- | gcc/function.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/gcc/function.c b/gcc/function.c index 1a495ac..4f989dd 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -821,7 +821,6 @@ assign_temp (tree type_or_decl, int keep, int memory_required, if (mode == BLKmode || memory_required) { HOST_WIDE_INT size = int_size_in_bytes (type); - tree size_tree; rtx tmp; /* Zero sized arrays are GNU C extension. Set size to 1 to avoid @@ -830,20 +829,10 @@ assign_temp (tree type_or_decl, int keep, int memory_required, size = 1; /* Unfortunately, we don't yet know how to allocate variable-sized - temporaries. However, sometimes we have a fixed upper limit on - the size (which is stored in TYPE_ARRAY_MAX_SIZE) and can use that - instead. This is the case for Chill variable-sized strings. */ - if (size == -1 && TREE_CODE (type) == ARRAY_TYPE - && TYPE_ARRAY_MAX_SIZE (type) != NULL_TREE - && host_integerp (TYPE_ARRAY_MAX_SIZE (type), 1)) - size = tree_low_cst (TYPE_ARRAY_MAX_SIZE (type), 1); - - /* If we still haven't been able to get a size, see if the language - can compute a maximum size. */ - if (size == -1 - && (size_tree = lang_hooks.types.max_size (type)) != 0 - && host_integerp (size_tree, 1)) - size = tree_low_cst (size_tree, 1); + temporaries. However, sometimes we can find a fixed upper limit on + the size, so try that instead. */ + else if (size == -1) + size = max_int_size_in_bytes (type); /* The size of the temporary may be too large to fit into an integer. */ /* ??? Not sure this should happen except for user silliness, so limit |