From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Yannick Moy <moy@adacore.com>
Subject: [COMMITTED] ada: Crash in GNATprove due to wrong detection of inlining
Date: Mon, 7 Aug 2023 13:16:37 +0200 [thread overview]
Message-ID: <20230807111637.2854994-1-poulhies@adacore.com> (raw)
From: Yannick Moy <moy@adacore.com>
When a function is called in a predicate, it was not properly detected
as not always inlined in GNATprove mode, which led to crashes later during
analysis. Fixed now.
gcc/ada/
* sem_res.adb (Resolve_Call): Always call Cannot_Inline so that
subprogram called is marked as not always inlined.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_res.adb | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index ac0c60f5f22..9755e4d14a6 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -7330,30 +7330,32 @@ package body Sem_Res is
or else Is_Invariant_Procedure (Current_Subprogram)
or else Is_DIC_Procedure (Current_Subprogram))
then
- if Present (Body_Id)
- and then Present (Body_To_Inline (Nam_Decl))
- then
+ declare
+ Issue_Msg : constant Boolean :=
+ Present (Body_Id)
+ and then Present (Body_To_Inline (Nam_Decl));
+ begin
if Is_Predicate_Function (Current_Subprogram) then
Cannot_Inline
("cannot inline & (inside predicate)?",
- N, Nam_UA);
+ N, Nam_UA, Suppress_Info => not Issue_Msg);
elsif Is_Invariant_Procedure (Current_Subprogram) then
Cannot_Inline
("cannot inline & (inside invariant)?",
- N, Nam_UA);
+ N, Nam_UA, Suppress_Info => not Issue_Msg);
elsif Is_DIC_Procedure (Current_Subprogram) then
Cannot_Inline
("cannot inline & (inside Default_Initial_Condition)?",
- N, Nam_UA);
+ N, Nam_UA, Suppress_Info => not Issue_Msg);
else
Cannot_Inline
("cannot inline & (inside expression function)?",
- N, Nam_UA);
+ N, Nam_UA, Suppress_Info => not Issue_Msg);
end if;
- end if;
+ end;
-- Cannot inline a call inside the definition of a record type,
-- typically inside the constraints of the type. Calls in
--
2.40.0
reply other threads:[~2023-08-07 11:16 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=20230807111637.2854994-1-poulhies@adacore.com \
--to=poulhies@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=moy@adacore.com \
/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).