aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.cc')
-rw-r--r--gcc/ada/gcc-interface/utils2.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc
index 4dfe29d..4c66a93 100644
--- a/gcc/ada/gcc-interface/utils2.cc
+++ b/gcc/ada/gcc-interface/utils2.cc
@@ -2259,6 +2259,8 @@ maybe_wrap_malloc (tree data_size, tree data_type, Node_Id gnat_node)
tree malloc_ptr = build_call_n_expr (malloc_decl, 1, size_to_malloc);
+ Check_Restriction_No_Dependence_On_System (Name_Memory, gnat_node);
+
if (aligning_type)
{
/* Latch malloc's return value and get a pointer to the aligning field
@@ -2305,7 +2307,7 @@ maybe_wrap_malloc (tree data_size, tree data_type, Node_Id gnat_node)
designated by DATA_PTR using the __gnat_free entry point. */
static inline tree
-maybe_wrap_free (tree data_ptr, tree data_type)
+maybe_wrap_free (tree data_ptr, tree data_type, Node_Id gnat_node)
{
/* In the regular alignment case, we pass the data pointer straight to free.
In the superaligned case, we need to retrieve the initial allocator
@@ -2317,6 +2319,8 @@ maybe_wrap_free (tree data_ptr, tree data_type)
tree free_ptr;
+ Check_Restriction_No_Dependence_On_System (Name_Memory, gnat_node);
+
if (data_align > system_allocator_alignment)
{
/* DATA_FRONT_PTR (void *)
@@ -2363,7 +2367,7 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, tree gnu_type,
/* Otherwise, object to "free" or "malloc" with possible special processing
for alignments stricter than what the default allocator honors. */
else if (gnu_obj)
- return maybe_wrap_free (gnu_obj, gnu_type);
+ return maybe_wrap_free (gnu_obj, gnu_type, gnat_node);
else
{
/* Assert that we no longer can be called with this special pool. */