[Ada] Incorrect accessibility check on return of discriminated type

This patch corrects an error in the compiler whereby the presence of a
call to a function returning a type with an access discriminant within
an expanded loop condition caused the wrong value to be supplied for the
extra- accessibility-of-result actual, thus causing incorrect checks
within the callee at the point of return.

This change also corrects a problem where spurious "null value not
allowed" warnings were generated for tagged type declarations with an
access discriminant specified as "null."

gcc/ada/

	* sem_disp.adb (Most_Descendant_Use_Clause): Remove call to
	deprecated Is_Internal.
	* sem_util.adb (Innermost_Master_Scope_Depth): Use
	Find_Enclosing_Scope instead of Nearest_Dynamic_Scope to avoid
	cases where relevant scopes get skipped leading to an incorrect
	scope depth calculation.
2 files changed