aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index cb3d778..ca36ce5 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -5585,6 +5585,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
bool ro_param = in_param && !Address_Taken (gnat_param);
bool by_return = false, by_component_ptr = false;
bool by_ref = false;
+ bool restricted_aliasing_p = false;
tree gnu_param;
/* Copy-return is used only for the first parameter of a valued procedure.
@@ -5675,15 +5676,12 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
|| (!foreign
&& default_pass_by_ref (gnu_param_type)))))
{
+ gnu_param_type = build_reference_type (gnu_param_type);
/* We take advantage of 6.2(12) by considering that references built for
parameters whose type isn't by-ref and for which the mechanism hasn't
- been forced to by-ref are restrict-qualified in the C sense. */
- bool restrict_p
+ been forced to by-ref allow only a restricted form of aliasing. */
+ restricted_aliasing_p
= !TYPE_IS_BY_REFERENCE_P (gnu_param_type) && mech != By_Reference;
- gnu_param_type = build_reference_type (gnu_param_type);
- if (restrict_p)
- gnu_param_type
- = change_qualified_type (gnu_param_type, TYPE_QUAL_RESTRICT);
by_ref = true;
}
@@ -5731,6 +5729,7 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech,
DECL_POINTS_TO_READONLY_P (gnu_param)
= (ro_param && (by_ref || by_component_ptr));
DECL_CAN_NEVER_BE_NULL_P (gnu_param) = Can_Never_Be_Null (gnat_param);
+ DECL_RESTRICTED_ALIASING_P (gnu_param) = restricted_aliasing_p;
/* If no Mechanism was specified, indicate what we're using, then
back-annotate it. */