aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-03-17 19:05:10 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-17 08:25:45 +0000
commitca3e565395b8e49f90482409c7cb2da5fccb5b26 (patch)
tree4134273059a469c41acd08bcd894eb1f69880f64 /gcc/fortran
parent27b2b83bd7c1a9dfdba4ef27ea120ae5e1ead0b0 (diff)
downloadgcc-ca3e565395b8e49f90482409c7cb2da5fccb5b26.zip
gcc-ca3e565395b8e49f90482409c7cb2da5fccb5b26.tar.gz
gcc-ca3e565395b8e49f90482409c7cb2da5fccb5b26.tar.bz2
[Ada] Fix bogus visibility error with partially parameterized formal package
The problem comes from the special instantiation (abbreviated instantiation in GNAT parlance) done to check conformance between a formal package and its corresponding actual in a generic instantiation: the compiler instantiates the formal package, in the context of the generic instantiation, so that it can check the conformance of the actual with the result. More precisely, it occurs with formal packages that are only partially parameterized, i.e. that have at least one parameter association and an (others => <>) choice. In this case, RM 12.7(10/2) says that the visible part of the formal package contains a copy of the formal parameters that are not explicitly associated. The analysis of these copies for the abbreviated instantiation is not done in the correct context when the generic unit is a child generic unit. gcc/ada/ * sem_ch12.ads (Is_Abbreviated_Instance): Declare. * sem_ch12.adb (Check_Abbreviated_Instance): Declare. (Requires_Conformance_Checking): Declare. (Analyze_Association.Process_Default): Fix subtype of parameter. (Analyze_Formal_Object_Declaration): Check whether it is in the visible part of abbreviated instance. (Analyze_Formal_Subprogram_Declaration): Likewise. (Analyze_Formal_Type_Declaration): Likewise. (Analyze_Package_Instantiation): Do not check for a generic child unit in the case of an abbreviated instance. (Check_Abbreviated_Instance): New procedure. (Check_Formal_Packages): Tidy up. (Copy_Generic_Elist): Fix comment. (Instantiate_Formal_Package): Tidy up. If the generic unit is a child unit, copy the qualified name onto the abbreviated instance. (Is_Abbreviated_Instance): New function. (Collect_Previous_Instances): Call Is_Abbreviated_Instance. (Requires_Conformance_Checking): New function. * sem_ch7.adb (Analyze_Package_Specification): Do not install the private declarations of the parent for an abbreviated instance.
Diffstat (limited to 'gcc/fortran')
0 files changed, 0 insertions, 0 deletions