summaryrefslogtreecommitdiffstats
path: root/gcc/ada/exp_ch6.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-24 13:01:09 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2013-04-24 13:01:09 +0000
commit346450208f068bea4383c64595666f56f5f3fb19 (patch)
tree781b21d6e1e2aa0ae4b87e428407ea11858bafeb /gcc/ada/exp_ch6.adb
parent99646b030c2a3289b858e59b7a69a8a00a2da7a6 (diff)
downloadppe42-gcc-346450208f068bea4383c64595666f56f5f3fb19.tar.gz
ppe42-gcc-346450208f068bea4383c64595666f56f5f3fb19.zip
2013-04-24 Ed Schonberg <schonberg@adacore.com>
* sem_ch3.adb: Create packed array only when expander is active. 2013-04-24 Hristian Kirtchev <kirtchev@adacore.com> * sem_prag.adb (Analyze_Depends_In_Decl_Part): Install the formals only when the context warrants it. (Analyze_Global_In_Decl_List): Install the formals only when the context warrants it. (Requires_Profile_Installation): New routine. 2013-04-24 Ed Schonberg <schonberg@adacore.com> * exp_ch6.adb (Expand_N_Simple_Return_Statement): When the return type is a discriminated private type that does not require use of the secondary stack, a constrained subtype of the underlying type is created to convey the proper object size to the backend. If the return type is originally a private type, the return expression is wrapped in an unchecked_conversion. If the return expression is used subsequently in a call to the postcondition function, this conversion must be undone to prevent a spurious error on the analysis of that call. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198222 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r--gcc/ada/exp_ch6.adb15
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index b0977797603..dc43046ac03 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -7902,10 +7902,23 @@ package body Exp_Ch6 is
else
declare
- ExpR : constant Node_Id := Relocate_Node (Exp);
+ ExpR : Node_Id := Relocate_Node (Exp);
Tnn : constant Entity_Id := Make_Temporary (Loc, 'T', ExpR);
begin
+ -- In the case of discriminated objects, we have created a
+ -- constrained subtype above, and used the underlying type.
+ -- This transformation is post-analysis and harmless, except
+ -- that now the call to the post-condition will be analyzed and
+ -- type kinds have to match.
+
+ if Nkind (ExpR) = N_Unchecked_Type_Conversion
+ and then
+ Is_Private_Type (R_Type) /= Is_Private_Type (Etype (ExpR))
+ then
+ ExpR := Expression (ExpR);
+ end if;
+
-- For a complex expression of an elementary type, capture
-- value in the temporary and use it as the reference.
OpenPOWER on IntegriCloud