From: pmderodat Date: Thu, 10 Oct 2019 15:23:14 +0000 (+0000) Subject: [Ada] Spurious restriction violation on Ghost code X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b076a7b1e6a905f3535f1e282dd4fef4482d7038;p=thirdparty%2Fgcc.git [Ada] Spurious restriction violation on Ghost code 2019-10-10 Ed Schonberg gcc/ada/ * exp_ch6.adb (Expand_Simple_Function_Return_Statement): If the function to which the return statement applies is an Ignored_Ghost_Function, do not indicate that it uses the secondary stack when the return type is unconstrained. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@276814 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 745c7b57b164..7579bb360988 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,15 +1,6 @@ -2019-10-10 Bob Duff +2019-10-10 Ed Schonberg - * libgnat/a-cbdlli.adb, libgnat/a-cbhama.adb, - libgnat/a-cbhase.adb, libgnat/a-cbmutr.adb, - libgnat/a-cborma.adb, libgnat/a-cborse.adb, - libgnat/a-cdlili.adb, libgnat/a-cidlli.adb, - libgnat/a-cihama.adb, libgnat/a-cihase.adb, - libgnat/a-cimutr.adb, libgnat/a-ciorma.adb, - libgnat/a-ciorse.adb, libgnat/a-cobove.adb, - libgnat/a-cohama.adb, libgnat/a-cohase.adb, - libgnat/a-coinve.adb, libgnat/a-comutr.adb, - libgnat/a-conhel.adb, libgnat/a-convec.adb, - libgnat/a-coorma.adb, libgnat/a-coorse.adb (Reference, - Constant_Reference): Use Busy instead of Lock, so we forbid - tampering with cursors, rather than tampering with elements. \ No newline at end of file + * exp_ch6.adb (Expand_Simple_Function_Return_Statement): If the + function to which the return statement applies is an + Ignored_Ghost_Function, do not indicate that it uses the + secondary stack when the return type is unconstrained. \ No newline at end of file diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index c569ca33af78..b31132281bf8 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -6895,7 +6895,12 @@ package body Exp_Ch6 is elsif Is_Thunk (Current_Scope) and then Is_Incomplete_Type (Exptyp) then return; - elsif not Requires_Transient_Scope (R_Type) then + -- A return statement from a 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) + then -- Mutable records with variable-length components are not returned -- on the sec-stack, so we need to make sure that the back end will