From: Ed Schonberg Date: Thu, 10 Oct 2019 15:23:14 +0000 (+0000) Subject: [Ada] Spurious restriction violation on Ghost code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=95a7982243dd1e589ed59007d36f36027a3412ef;p=gcc.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. From-SVN: r276814 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 745c7b57b16..7579bb36098 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 c569ca33af7..b31132281bf 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