From: Yannick Moy Date: Mon, 16 Dec 2019 10:33:41 +0000 (+0000) Subject: [Ada] Do not issue restriction violations on ignored ghost code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bee69f33688293b0c5afdf737d03aca12a8fccb4;p=gcc.git [Ada] Do not issue restriction violations on ignored ghost code 2019-12-16 Yannick Moy gcc/ada/ * exp_ch6.adb: Fix comment. * sem_res.adb (Resolve_Call): Do not check No_Recursion restriction or indirectly No_Secondary_Stack restriction, when inside an ignored ghost subprogram. From-SVN: r279419 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c86fd3f9dbf..e1952da7941 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-12-16 Yannick Moy + + * exp_ch6.adb: Fix comment. + * sem_res.adb (Resolve_Call): Do not check No_Recursion + restriction or indirectly No_Secondary_Stack restriction, when + inside an ignored ghost subprogram. + 2019-12-16 Arnaud Charlet * impunit.adb: Add a-nbnbin, a-nbnbre, a-nubinu to Ada 2020 diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 62934c3d44e..b50e5d0127c 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -6934,8 +6934,8 @@ package body Exp_Ch6 is elsif Is_Thunk (Current_Scope) and then Is_Incomplete_Type (Exptyp) then return; - -- A return statement from a Ghost function does not use the secondary - -- stack (or any other one). + -- A return statement from an ignored Ghost function does not use the + -- secondary stack (or any other one). elsif not Requires_Transient_Scope (R_Type) or else Is_Ignored_Ghost_Entity (Scope_Id) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 2628a5ab8e5..32d9fadac07 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -6675,7 +6675,9 @@ package body Sem_Res is -- checkable, the case of calling an immediately containing -- subprogram is easy to catch. - Check_Restriction (No_Recursion, N); + if not Is_Ignored_Ghost_Entity (Nam) then + Check_Restriction (No_Recursion, N); + end if; -- If the recursive call is to a parameterless subprogram, -- then even if we can't statically detect infinite @@ -6820,9 +6822,13 @@ package body Sem_Res is then null; + -- A return statement from an ignored Ghost function does not use the + -- secondary stack (or any other one). + elsif Expander_Active and then Ekind_In (Nam, E_Function, E_Subprogram_Type) and then Requires_Transient_Scope (Etype (Nam)) + and then not Is_Ignored_Ghost_Entity (Nam) then Establish_Transient_Scope (N, Manage_Sec_Stack => True);