r260596 - in /trunk/gcc: ada/ChangeLog ada/einf...

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Wed May 23 10:23:00 GMT 2018


Author: pmderodat
Date: Wed May 23 10:23:48 2018
New Revision: 260596

URL: https://gcc.gnu.org/viewcvs?rev=260596&root=gcc&view=rev
Log:
[Ada] Spurious error on instantiation with type with unknown discriminants

This patch fixes a spurious error when instantiating an indefinite container
with a private type with unknown discriminants, when its full view is an
unconstrained array type. It also cleans up the inheritance of dynamic
predicates inherited by anonymous subtypes of array types.

2018-05-23  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* einfo.ads: New attribute on types: Predicated_Parent, to simplify the
	retrieval of the applicable predicate function to an itype created for
	a constrained array component.
	* einfo.adb: Subprograms for Predicated_Parent.
	(Predicate_Function): Use new attribute.
	* exp_util.adb (Make_Predicate_Call): If the predicate function is not
	available for a subtype, retrieve it from the base type, which may have
	been frozen after the subtype declaration and not captured by the
	subtype declaration.
	* sem_aggr.adb (Resolve_Array_Aggregate): An Others association is
	legal within a generated initiqlization procedure, as may happen with a
	predicate check on a component, when the predicate function applies to
	the base type of the component.
	* sem_ch3.adb (Analyze_Subtype_Declaration): Clean up inheritance of
	predicates for subtype declarations and for subtype indications in
	other contexts.
	(Process_Subtype): Likewise. Handle properly the case of a private type
	with unknown discriminants whose full view is an unconstrained array.
	Use Predicated_Parent to indicate source of predicate function on an
	itype whose parent is itself an itype.
	(Complete_Private_Subtype): If the private view has unknown
	discriminants and the full view is an unconstrained array, set base
	type of completion to the full view of parent.
	(Inherit_Predicate_Flags): Prevent double assignment of predicate
	function and flags.
	(Build_Subtype): For a constrained array component, propagate predicate
	information from original component type declaration.

gcc/testsuite/

	* gnat.dg/discr51.adb: New testcase.

Added:
    trunk/gcc/testsuite/gnat.dg/discr51.adb
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/einfo.adb
    trunk/gcc/ada/einfo.ads
    trunk/gcc/ada/exp_util.adb
    trunk/gcc/ada/sem_aggr.adb
    trunk/gcc/ada/sem_ch3.adb
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-cvs mailing list