public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-895] [Ada] Fix bad interaction between Inline_Always and -gnateV + -gnata
@ 2022-06-01  8:45 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-06-01  8:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:66f2a0def548b7f2e4edb46e50fc0b72e84532cc

commit r13-895-g66f2a0def548b7f2e4edb46e50fc0b72e84532cc
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Fri May 6 22:48:04 2022 +0200

    [Ada] Fix bad interaction between Inline_Always and -gnateV + -gnata
    
    The combination of pragma/aspect Inline_Always and -gnateV -gnata runs
    afoul of the handling of inlining across units by gigi, which does not
    inline a subprogram that calls nested subprograms if these subprograms
    are not themselves inlined.
    
    This condition does not apply to internally generated subprograms but
    the special _postconditions procedure has Debug_Info_Needed set so it
    is not considered as such and, as a consequence, triggers an error if
    the enclosing subprogram requires inlining by means of Inline_Always.
    
    The _postconditions procedure is already marked inlined when generating
    C code so it makes sense to mark it inlined in the general case as well.
    
    gcc/ada/
    
            * contracts.adb (Build_Postconditions_Procedure): Set Is_Inlined
            unconditionnally on the procedure entity.

Diff:
---
 gcc/ada/contracts.adb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index 9463642556f..ed97d16818f 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -2365,6 +2365,10 @@ package body Contracts is
          Set_Debug_Info_Needed   (Proc_Id);
          Set_Postconditions_Proc (Subp_Id, Proc_Id);
 
+         --  Mark it inlined to speed up the call
+
+         Set_Is_Inlined (Proc_Id);
+
          --  Force the front-end inlining of _Postconditions when generating C
          --  code, since its body may have references to itypes defined in the
          --  enclosing subprogram, which would cause problems for unnesting
@@ -2373,7 +2377,6 @@ package body Contracts is
          if Modify_Tree_For_C then
             Set_Has_Pragma_Inline        (Proc_Id);
             Set_Has_Pragma_Inline_Always (Proc_Id);
-            Set_Is_Inlined               (Proc_Id);
          end if;
 
          --  The related subprogram is a function: create the specification of


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-01  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01  8:45 [gcc r13-895] [Ada] Fix bad interaction between Inline_Always and -gnateV + -gnata Pierre-Marie de Rodat

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).