From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Eric Botcazou <ebotcazou@adacore.com>
Subject: [COMMITTED] ada: Fix recent assertion failure on GPR2
Date: Tue, 22 Nov 2022 13:36:20 +0100 [thread overview]
Message-ID: <20221122123620.336156-1-poulhies@adacore.com> (raw)
From: Eric Botcazou <ebotcazou@adacore.com>
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.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/contracts.adb | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index fef3d24870f..6f474eb2944 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
--
2.34.1
reply other threads:[~2022-11-22 12:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221122123620.336156-1-poulhies@adacore.com \
--to=poulhies@adacore.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).