diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-18 14:41:00 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-12-18 14:41:00 +0000 |
commit | 35f467653238c6a37c6a3ef117ce7a7743d6aa1e (patch) | |
tree | 0a142fcd6ce856dec9298f10e5d77f444c652cd3 | |
parent | 9d5fd7d0aa0d916132ad0bad4d4e3e2ee44ea321 (diff) | |
download | gcc-35f467653238c6a37c6a3ef117ce7a7743d6aa1e.tar.gz |
* gcc-interface/decl.c (gnat_to_gnu_param): Add comment about double
reference and DECL_POINTS_TO_READONLY_P.
* gcc-interface/trans.c (Identifier_to_gnu) <by_ref>: Always set the
TREE_READONLY flag on the first dereference of a double dereference.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182460 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 4 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 5 |
3 files changed, 14 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5c936f2fc6a..0533f9cfd4c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2011-12-18 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_param): Add comment about double + reference and DECL_POINTS_TO_READONLY_P. + * gcc-interface/trans.c (Identifier_to_gnu) <by_ref>: Always set the + TREE_READONLY flag on the first dereference of a double dereference. + 2011-12-15 Arnaud Charlet <charlet@adacore.com> * a-numaux-vms.ads, s-asthan-vms-ia64.adb, s-auxdec-vms-ia64.adb, diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index c3774f2a6ba..89a6a2ea2cc 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -5587,6 +5587,10 @@ gnat_to_gnu_param (Entity_Id gnat_param, Mechanism_Type mech, DECL_BY_COMPONENT_PTR_P (gnu_param) = by_component_ptr; DECL_BY_DESCRIPTOR_P (gnu_param) = (mech == By_Descriptor || mech == By_Short_Descriptor); + /* Note that, in case of a parameter passed by double reference, the + DECL_POINTS_TO_READONLY_P flag is meant for the second reference. + The first reference always points to read-only, as it points to + the second reference, i.e. the reference to the actual parameter. */ 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); diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index da1a8f1f4ee..3640782dbc0 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1038,8 +1038,9 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) if (TREE_CODE (gnu_result) == INDIRECT_REF) TREE_THIS_NOTRAP (gnu_result) = 1; - if (read_only) - TREE_READONLY (gnu_result) = 1; + /* The first reference, in case of a double reference, always points + to read-only, see gnat_to_gnu_param for the rationale. */ + TREE_READONLY (gnu_result) = 1; } /* If it's a PARM_DECL to foreign convention subprogram, convert it. */ |