public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3740] ada: Fix inherited postconditions in inlined subprograms
@ 2022-11-07  8:39 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2022-11-07  8:39 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:27345558cce16e849884f5d1d4dd7d88974bb724

commit r13-3740-g27345558cce16e849884f5d1d4dd7d88974bb724
Author: Bob Duff <duff@adacore.com>
Date:   Thu Oct 13 17:12:18 2022 -0400

    ada: Fix inherited postconditions in inlined subprograms
    
    Protect the building of postcondition pragmas in case the
    postcondition is not present due to inlining.
    
    gcc/ada/
    
            * freeze.adb
            (Build_Inherited_Condition_Pragmas): Do nothing if A_Post is
            empty.

Diff:
---
 gcc/ada/freeze.adb | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 888e2ecb7af..1fdc9d0d60e 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -1718,11 +1718,16 @@ package body Freeze is
                end;
             end if;
 
-            New_Prag := New_Copy_Tree (A_Post);
-            Rewrite
-              (Expression (First (Pragma_Argument_Associations (New_Prag))),
-               Class_Post);
-            Append (New_Prag, Decls);
+            --  A_Post can be null here if the postcondition was inlined in the
+            --  called subprogram.
+
+            if Present (A_Post) then
+               New_Prag := New_Copy_Tree (A_Post);
+               Rewrite
+                 (Expression (First (Pragma_Argument_Associations (New_Prag))),
+                  Class_Post);
+               Append (New_Prag, Decls);
+            end if;
          end if;
       end Build_Inherited_Condition_Pragmas;

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

only message in thread, other threads:[~2022-11-07  8:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07  8:39 [gcc r13-3740] ada: Fix inherited postconditions in inlined subprograms Marc Poulhi?s

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