aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/contracts.adb
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-11-19 18:01:21 +0100
committerMarc Poulhiès <poulhies@adacore.com>2022-11-22 13:34:51 +0100
commitcd4b47a9f7db20197bbe25cb60c9a8d8ef46de71 (patch)
tree5d29d3c79dbb4a2cc0b80bee4ccb5d0cc1900963 /gcc/ada/contracts.adb
parente4faee8d02ec5d65bf418612f7181823eb08c078 (diff)
downloadgcc-cd4b47a9f7db20197bbe25cb60c9a8d8ef46de71.zip
gcc-cd4b47a9f7db20197bbe25cb60c9a8d8ef46de71.tar.gz
gcc-cd4b47a9f7db20197bbe25cb60c9a8d8ef46de71.tar.bz2
ada: Fix recent assertion failure on GPR2
It's the compiler trying to load the nonexistent body of a generic package when trying to inline a call to an expression function of this package that has a pre or post-condition (hence the need for -gnata to trigger the ICE). gcc/ada/ * contracts.adb (Build_Subprogram_Contract_Wrapper): Do not fiddle with the Was_Expression_Function flag. Move a few lines around.
Diffstat (limited to 'gcc/ada/contracts.adb')
-rw-r--r--gcc/ada/contracts.adb18
1 files changed, 4 insertions, 14 deletions
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index fef3d24..6f474eb 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -1691,6 +1691,10 @@ package body Contracts is
Set_Debug_Info_Needed (Wrapper_Id);
Set_Wrapped_Statements (Subp_Id, Wrapper_Id);
+ Set_Has_Pragma_Inline (Wrapper_Id, Has_Pragma_Inline (Subp_Id));
+ Set_Has_Pragma_Inline_Always
+ (Wrapper_Id, Has_Pragma_Inline_Always (Subp_Id));
+
-- Create specification and declaration for the wrapper
if No (Ret_Type) or else Ret_Type = Standard_Void_Type then
@@ -1719,20 +1723,6 @@ package body Contracts is
Make_Handled_Sequence_Of_Statements (Loc,
End_Label => Make_Identifier (Loc, Chars (Wrapper_Id))));
- -- Move certain flags which are relevant to the body
-
- -- Wouldn't a better way be to perform some sort of copy of Body_Decl
- -- for Wrapper_Body be less error-prone ???
-
- if Was_Expression_Function (Body_Decl) then
- Set_Was_Expression_Function (Body_Decl, False);
- Set_Was_Expression_Function (Wrapper_Body);
- end if;
-
- Set_Has_Pragma_Inline (Wrapper_Id, Has_Pragma_Inline (Subp_Id));
- Set_Has_Pragma_Inline_Always
- (Wrapper_Id, Has_Pragma_Inline_Always (Subp_Id));
-
-- Prepend a call to the wrapper when the subprogram is a procedure
if No (Ret_Type) or else Ret_Type = Standard_Void_Type then