ada: Fix missing error for too deep accessibility level in aggregate return

The issue occurs when an access discriminant in an aggregate return is set
to a value obtained by means of a function call written in prefixed form.

The change also adjusts the implementation of the RM 6.5(5.9) rule, which
was hijacking the machinery of dynamic accessibility checks for a static
accessibility check, thus incorrectly flagging stand-alone objects of an
anonymous access type in Ada 2012 and later, per the RM 3.10.2(19.2) rule.

It also merges the implementations of the RM 3.10.2(28) rule for named and
anonymous access types in a single block of code.

gcc/ada/ChangeLog:

	* einfo.ads (Is_Local_Anonymous_Access): Mention access results.
	* accessibility.adb (Accessibility_Level): Add missing guard on
	the entity for error cases.  In the component cases, retrieve the
	function call if the prefix is a captured function call.  Remove
	the bypass returning the library level in a return context if the
	prefix is a function call.  Call Function_Call_Or_Allocator_Level
	in this case when the level of the prefix is tied to that of the
	result of the enclosing function.
	(Check_Return_Construct_Accessibility): Change the implementation
	to do a bona-fide static accessibility check.
	* sem_attr.adb (Resolve_Attribute) <Attribute_Access>: Merge the
	implementations of the RM 3.10.2(28) rule for named and anonymous
	access types.
	* sem_ch6.adb (Analyze_Expression_Function): Set the Ekind of the
	entity created for the body very early.
	* sem_util.adb (In_Return_Value): Fix typo in comment.
5 files changed