diff options
author | Javier Miranda <miranda@adacore.com> | 2023-03-06 11:43:28 +0100 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2023-03-06 11:45:24 +0100 |
commit | 14e5b65fd9bb6a848adda8ec939840c8f3ea6b40 (patch) | |
tree | 592ccd31597871f545f55dbab62018f00d408c42 /gcc/ada/sem_ch6.adb | |
parent | 94a67e3044212592ce408952c526210a81e1bf49 (diff) | |
download | gcc-14e5b65fd9bb6a848adda8ec939840c8f3ea6b40.zip gcc-14e5b65fd9bb6a848adda8ec939840c8f3ea6b40.tar.gz gcc-14e5b65fd9bb6a848adda8ec939840c8f3ea6b40.tar.bz2 |
Fix assertion failure on VSS library
gcc/ada/
PR ada/108858
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): For functions with
separate spec, if their return type was visible through a limited-
with context clause, their extra formals were not added when the
spec was analyzed. Now the full view must be available, and the
extra formals can be created and Returns_By_Ref computed.
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r-- | gcc/ada/sem_ch6.adb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 944e638..d4701ae 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -3836,6 +3836,21 @@ package body Sem_Ch6 is Spec_Decl := Unit_Declaration_Node (Spec_Id); Verify_Overriding_Indicator; + -- For functions with separate spec, if their return type was visible + -- through a limited-with context clause, their extra formals were + -- not added when the spec was frozen. Now the full view must be + -- available, and the extra formals can be created and Returns_By_Ref + -- computed (required to generate its return statements). + + if Ekind (Spec_Id) = E_Function + and then From_Limited_With (Etype (Spec_Id)) + and then Is_Build_In_Place_Function (Spec_Id) + and then not Has_BIP_Formals (Spec_Id) + then + Create_Extra_Formals (Spec_Id); + Compute_Returns_By_Ref (Spec_Id); + end if; + -- In general, the spec will be frozen when we start analyzing the -- body. However, for internally generated operations, such as -- wrapper functions for inherited operations with controlling |