diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2015-04-08 09:08:12 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2015-04-08 09:08:12 +0000 |
commit | 113c69ff2d41091359ec37789974cc47f1169e05 (patch) | |
tree | baa5f85fcaf8970ce98360f75251932428ea8095 /gcc/ada | |
parent | 43941fa55c5246c51a31c86df1006819ec67d8e0 (diff) | |
download | gcc-113c69ff2d41091359ec37789974cc47f1169e05.zip gcc-113c69ff2d41091359ec37789974cc47f1169e05.tar.gz gcc-113c69ff2d41091359ec37789974cc47f1169e05.tar.bz2 |
decl.c (gnat_to_gnu_entity): Do not make a function returning an unconstrained type 'const' for the middle-end.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Function>: Do not make
a function returning an unconstrained type 'const' for the middle-end.
* gcc-interface/trans.c (Pragma_to_gnu) <case Pragma_Warning>: Use
exact condition to detect Reason => "..." pattern.
From-SVN: r221916
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 20 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 3 |
3 files changed, 22 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 8b9fbe5..d93e5ac 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2015-04-08 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Function>: Do not make + a function returning an unconstrained type 'const' for the middle-end. + + * gcc-interface/trans.c (Pragma_to_gnu) <case Pragma_Warning>: Use + exact condition to detect Reason => "..." pattern. + 2015-03-31 Tom de Vries <tom@codesourcery.com> PR ada/65490 diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 0027d6f..d908a1b 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -4266,8 +4266,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) return_by_direct_ref_p = true; } - /* If we are supposed to return an unconstrained array type, make - the actual return type the fat pointer type. */ + /* If the return type is an unconstrained array type, the return + value will be allocated on the secondary stack so the actual + return type is the fat pointer type. */ else if (TREE_CODE (gnu_return_type) == UNCONSTRAINED_ARRAY_TYPE) { gnu_return_type = TREE_TYPE (gnu_return_type); @@ -4275,8 +4276,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) } /* Likewise, if the return type requires a transient scope, the - return value will be allocated on the secondary stack so the - actual return type is the pointer type. */ + return value will also be allocated on the secondary stack so + the actual return type is the pointer type. */ else if (Requires_Transient_Scope (gnat_return_type)) { gnu_return_type = build_pointer_type (gnu_return_type); @@ -4591,11 +4592,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) return_by_direct_ref_p, return_by_invisi_ref_p); - /* A subprogram (something that doesn't return anything) shouldn't - be considered const since there would be no reason for such a + /* A procedure (something that doesn't return anything) shouldn't be + considered const since there would be no reason for calling such a subprogram. Note that procedures with Out (or In Out) parameters - have already been converted into a function with a return type. */ - if (TREE_CODE (gnu_return_type) == VOID_TYPE) + have already been converted into a function with a return type. + Similarly, if the function returns an unconstrained type, then the + function will allocate the return value on the secondary stack and + thus calls to it cannot be CSE'ed, lest the stack be reclaimed. */ + if (TREE_CODE (gnu_return_type) == VOID_TYPE || return_unconstrained_p) const_flag = false; if (const_flag || volatile_flag) diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 7379477..6ffee06 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1444,7 +1444,8 @@ Pragma_to_gnu (Node_Id gnat_node) } /* Deal with optional pattern (but ignore Reason => "..."). */ - if (Present (Next (gnat_temp)) && No (Chars (Next (gnat_temp)))) + if (Present (Next (gnat_temp)) + && Chars (Next (gnat_temp)) != Name_Reason) { /* pragma Warnings (On | Off, Name) is handled differently. */ if (Nkind (Expression (Next (gnat_temp))) != N_String_Literal) |