diff options
author | Yannick Moy <moy@adacore.com> | 2019-12-16 10:33:41 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-12-16 10:33:41 +0000 |
commit | bee69f33688293b0c5afdf737d03aca12a8fccb4 (patch) | |
tree | dddd1701bd41a83ab69b05a397ed2a05c3fb6a1b /gcc/ada | |
parent | f17f5647c5ed92a114f23d1f92f6bb3d7815bf87 (diff) | |
download | gcc-bee69f33688293b0c5afdf737d03aca12a8fccb4.zip gcc-bee69f33688293b0c5afdf737d03aca12a8fccb4.tar.gz gcc-bee69f33688293b0c5afdf737d03aca12a8fccb4.tar.bz2 |
[Ada] Do not issue restriction violations on ignored ghost code
2019-12-16 Yannick Moy <moy@adacore.com>
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
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/exp_ch6.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 8 |
3 files changed, 16 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c86fd3f..e1952da 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-12-16 Yannick Moy <moy@adacore.com> + + * 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 <charlet@adacore.com> * 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 62934c3..b50e5d0 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 2628a5a..32d9fad 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); |