diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2021-01-03 21:40:04 +0100 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2021-01-03 21:40:04 +0100 |
commit | afae4a55ccaa0de95ea11e5f634084db6ab2f444 (patch) | |
tree | d632cc867d10410ba9fb750523be790b86846ac4 /gcc/ada/inline.adb | |
parent | 9d9a82ec8478ff52c7a9d61f58cd2a7b6295b5f9 (diff) | |
parent | d2eb616a0f7bea78164912aa438c29fe1ef5774a (diff) | |
download | gcc-afae4a55ccaa0de95ea11e5f634084db6ab2f444.zip gcc-afae4a55ccaa0de95ea11e5f634084db6ab2f444.tar.gz gcc-afae4a55ccaa0de95ea11e5f634084db6ab2f444.tar.bz2 |
Merge branch 'master' into devel/coarray_native
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r-- | gcc/ada/inline.adb | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index b4d56b6..bb4d97c 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -1945,10 +1945,11 @@ package body Inline is ------------------- procedure Cannot_Inline - (Msg : String; - N : Node_Id; - Subp : Entity_Id; - Is_Serious : Boolean := False) + (Msg : String; + N : Node_Id; + Subp : Entity_Id; + Is_Serious : Boolean := False; + Suppress_Info : Boolean := False) is begin -- In GNATprove mode, inlining is the technical means by which the @@ -1971,7 +1972,7 @@ package body Inline is New_Msg (1 .. Len2) := "info: no contextual analysis of"; New_Msg (Len2 + 1 .. Msg'Length + Len2 - Len1) := Msg (Msg'First + Len1 .. Msg'Last); - Cannot_Inline (New_Msg, N, Subp, Is_Serious); + Cannot_Inline (New_Msg, N, Subp, Is_Serious, Suppress_Info); return; end; end if; @@ -1992,14 +1993,14 @@ package body Inline is then null; - -- In GNATprove mode, issue a warning when -gnatd_f is set, and - -- indicate that the subprogram is not always inlined by setting - -- flag Is_Inlined_Always to False. + -- In GNATprove mode, issue an info message when -gnatd_f is set and + -- Suppress_Info is False, and indicate that the subprogram is not + -- always inlined by setting flag Is_Inlined_Always to False. elsif GNATprove_Mode then Set_Is_Inlined_Always (Subp, False); - if Debug_Flag_Underscore_F then + if Debug_Flag_Underscore_F and not Suppress_Info then Error_Msg_NE (Msg, N, Subp); end if; @@ -2022,14 +2023,14 @@ package body Inline is Error_Msg_NE (Msg (Msg'First .. Msg'Last - 1), N, Subp); - -- In GNATprove mode, issue a warning when -gnatd_f is set, and - -- indicate that the subprogram is not always inlined by setting - -- flag Is_Inlined_Always to False. + -- In GNATprove mode, issue an info message when -gnatd_f is set and + -- Suppress_Info is False, and indicate that the subprogram is not + -- always inlined by setting flag Is_Inlined_Always to False. elsif GNATprove_Mode then Set_Is_Inlined_Always (Subp, False); - if Debug_Flag_Underscore_F then + if Debug_Flag_Underscore_F and not Suppress_Info then Error_Msg_NE (Msg, N, Subp); end if; @@ -2917,7 +2918,24 @@ package body Inline is -- formal in the inlined code. if Is_Entity_Name (A) and then Ekind (F) /= E_In_Parameter then - Set_Last_Assignment (Entity (A), Empty); + + -- In GNATprove mode a protected component acting as an actual + -- subprogram parameter will appear as inlined-for-proof. However, + -- its E_Component entity is not an assignable object, so the + -- assertion in Set_Last_Assignment will fail. We just omit the + -- call to Set_Last_Assignment, because GNATprove flags useless + -- assignments with its own flow analysis. + -- + -- In GNAT mode such a problem does not occur, because protected + -- components are inlined via object renamings whose entity kind + -- E_Variable is assignable. + + if Is_Assignable (Entity (A)) then + Set_Last_Assignment (Entity (A), Empty); + else + pragma Assert + (GNATprove_Mode and then Is_Protected_Component (Entity (A))); + end if; end if; -- If the argument may be a controlling argument in a call within |