gcc/ada/
	* sem_attr.adb (Declared_Within): Return True for objects
	declared within the attribute Loop_Entry prefix itself.
             --  within the related loop.
 
             function Declared_Within (Nod : Node_Id) return Boolean;
-            --  Determine whether Nod appears in the subtree of Loop_Decl
+            --  Determine whether Nod appears in the subtree of Loop_Decl but
+            --  not within the subtree of the prefix P itself.
 
             ---------------------
             -- Check_Reference --
                   if Stmt = Loop_Decl then
                      return True;
 
+                  elsif Stmt = P then
+                     return False;
+
                   --  Prevent the search from going too far
 
                   elsif Is_Body_Or_Package_Declaration (Stmt) then