aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/utils2.c
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2007-11-16 08:52:51 +0000
committerOlivier Hainque <hainque@gcc.gnu.org>2007-11-16 08:52:51 +0000
commitb2c3bcf47b9131455a7fccfaa699269ae108d76b (patch)
tree40b460c86146bcdff53b9a8c9239404f72196fbe /gcc/ada/utils2.c
parent823e5f7f9fb52d8e6a9bb2c97164cc593ae18e11 (diff)
downloadgcc-b2c3bcf47b9131455a7fccfaa699269ae108d76b.zip
gcc-b2c3bcf47b9131455a7fccfaa699269ae108d76b.tar.gz
gcc-b2c3bcf47b9131455a7fccfaa699269ae108d76b.tar.bz2
utils2.c (build_call_alloc_dealloc): Move the code retrieving an allocator return value from a super-aligned address...
2007-11-16 Olivier Hainque <hainque@adacore.com> ada/ * utils2.c (build_call_alloc_dealloc) <if gnu_obj>: Move the code retrieving an allocator return value from a super-aligned address from here to ... * trans.c (gnat_to_gnu) <case N_Free_Statement>: ... here, and don't expect a super-aligned address for a fat or thin pointer. testsuite/ * gnat.dg/release_unc_maxalign.adb: New test. From-SVN: r130221
Diffstat (limited to 'gcc/ada/utils2.c')
-rw-r--r--gcc/ada/utils2.c34
1 files changed, 1 insertions, 33 deletions
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c
index 350358f..b8f5947 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/utils2.c
@@ -1873,39 +1873,7 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align,
}
else if (gnu_obj)
- {
- /* If the required alignement was greater than what the default
- allocator guarantees, what we have in gnu_obj here is an address
- dynamically adjusted to match the requirement (see build_allocator).
- What we need to pass to free is the initial underlying allocator's
- return value, which has been stored just in front of the block we
- have. */
-
- unsigned int default_allocator_alignment
- = get_target_default_allocator_alignment () * BITS_PER_UNIT;
-
- if (align > default_allocator_alignment)
- {
- /* We set GNU_OBJ
- as * (void **)((void *)GNU_OBJ - (void *)sizeof(void *))
- in two steps: */
-
- /* GNU_OBJ (void *) = (void *)GNU_OBJ - (void *)sizeof (void *)) */
- gnu_obj
- = build_binary_op (MINUS_EXPR, ptr_void_type_node,
- convert (ptr_void_type_node, gnu_obj),
- convert (ptr_void_type_node,
- TYPE_SIZE_UNIT (ptr_void_type_node)));
-
- /* GNU_OBJ (void *) = *(void **)GNU_OBJ */
- gnu_obj
- = build_unary_op (INDIRECT_REF, NULL_TREE,
- convert (build_pointer_type (ptr_void_type_node),
- gnu_obj));
- }
-
- return build_call_1_expr (free_decl, gnu_obj);
- }
+ return build_call_1_expr (free_decl, gnu_obj);
/* ??? For now, disable variable-sized allocators in the stack since
we can't yet gimplify an ALLOCATE_EXPR. */