diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-09-18 14:45:51 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-26 04:59:11 -0400 |
commit | acd4ef9df257ce400c5eabfa9ab92a1b3196e090 (patch) | |
tree | 6cb386d8a244eb7a2d762a4b15c1d3ba5ce71359 /gcc/ada/inline.adb | |
parent | 4ab5d8c17b7b8ca792979997fb3a13b2c9eeba8b (diff) | |
download | gcc-acd4ef9df257ce400c5eabfa9ab92a1b3196e090.zip gcc-acd4ef9df257ce400c5eabfa9ab92a1b3196e090.tar.gz gcc-acd4ef9df257ce400c5eabfa9ab92a1b3196e090.tar.bz2 |
[Ada] Fix harmless assertion failure in GNATprove mode
gcc/ada/
* inline.adb (Establish_Actual_Mapping_For_Inlined_Call): Add
guard for a call to Set_Last_Assignment with the same condition
as the assertion in that routine and explain why this guard
fails in GNATprove mode.
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r-- | gcc/ada/inline.adb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index b4d56b6..c24763a 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -2917,7 +2917,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 |