[COMMITTED] ada: Fix retrieval of spec entity from entry body entity

Message ID 20230529082910.2409702-1-poulhies@adacore.com
State Committed
Commit a17e01a6ce3956d79454047bfe4a3a405e89be7f
Headers
Series [COMMITTED] ada: Fix retrieval of spec entity from entry body entity |

Commit Message

Marc Poulhiès May 29, 2023, 8:29 a.m. UTC
  From: Piotr Trojanek <trojanek@adacore.com>

When retrieving entities of subprogram spec we only handled functions
and procedures, but not entries. This had no consequences, because we
then only applied checks to functions, but still is worth a cleanup, so
the code is easier to adapt for access-to-subprogram entities as well.

gcc/ada/

	* sem_util.adb (Check_Result_And_Post_State): Properly handle entry
	bodies.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_util.adb | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 1839214332d..d71329bbcb2 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -4582,6 +4582,9 @@  package body Sem_Util is
       then
          Spec_Id := Corresponding_Spec_Of_Stub (Subp_Decl);
 
+      elsif Nkind (Subp_Decl) = N_Entry_Body then
+         Spec_Id := Corresponding_Spec (Subp_Decl);
+
       else
          Spec_Id := Subp_Id;
       end if;