diff mbox series

[Ada] Fix implementation of utility for finding enclosing declaration

Message ID 20180523103239.GA9442@adacore.com
State New
Headers show
Series [Ada] Fix implementation of utility for finding enclosing declaration | expand

Commit Message

Pierre-Marie de Rodat May 23, 2018, 10:32 a.m. UTC
This utility is used in GNATprove to find when a node is inside a named
number declaration, and this case was not properly handled. Now fixed.
There is no impact on compilation.

Tested on x86_64-pc-linux-gnu, committed on trunk

2018-05-23  Yannick Moy  <moy@adacore.com>

gcc/ada/

	* sem_util.adb (Enclosing_Declaration): Fix the case of a named number
	declaration, which was not taken into account.
diff mbox series

Patch

--- gcc/ada/sem_util.adb
+++ gcc/ada/sem_util.adb
@@ -6635,7 +6635,9 @@  package body Sem_Util is
       while Present (Decl)
         and then not (Nkind (Decl) in N_Declaration
                         or else
-                      Nkind (Decl) in N_Later_Decl_Item)
+                      Nkind (Decl) in N_Later_Decl_Item
+                        or else
+                      Nkind (Decl) = N_Number_Declaration)
       loop
          Decl := Parent (Decl);
       end loop;