From: Javier Miranda Date: Thu, 11 Jan 2018 08:52:47 +0000 (+0000) Subject: exp_util.adb (Remove_Side_Effects): No action done for functions returning class... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=78cac7386e2dc48ec5adb4ff0c9a94eed958c9fc;p=gcc.git exp_util.adb (Remove_Side_Effects): No action done for functions returning class-wide types since it requires... 2018-01-11 Javier Miranda gcc/ada/ * exp_util.adb (Remove_Side_Effects): No action done for functions returning class-wide types since it requires generating code using 'reference and the CCG target has no secondary stack. * gnat1drv.adb: Disable building static dispatch tables when generating C code. From-SVN: r256503 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9c104eceabd..01239868b12 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2018-01-11 Javier Miranda + + * exp_util.adb (Remove_Side_Effects): No action done for functions + returning class-wide types since it requires generating code using + 'reference and the CCG target has no secondary stack. + * gnat1drv.adb: Disable building static dispatch tables when generating + C code. + 2018-01-11 Piotr Trojanek * libgnat/a-direio.ads, libgnat/a-sequio.ads, libgnat/a-ststio.ads, diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 86b57dc0feb..000dc1dd2dc 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -11174,6 +11174,16 @@ package body Exp_Util is and then Side_Effect_Free (Exp, Name_Req, Variable_Ref) then return; + + -- Generating C code we cannot remove side effect of function returning + -- class-wide types since there is no secondary stack (required to use + -- 'reference). + + elsif Modify_Tree_For_C + and then Nkind (Exp) = N_Function_Call + and then Is_Class_Wide_Type (Etype (Exp)) + then + return; end if; -- The remaining processing is done with all checks suppressed diff --git a/gcc/ada/gnat1drv.adb b/gcc/ada/gnat1drv.adb index eda994d51ae..12ff49c7ab6 100644 --- a/gcc/ada/gnat1drv.adb +++ b/gcc/ada/gnat1drv.adb @@ -166,6 +166,7 @@ procedure Gnat1drv is if Generate_C_Code then Modify_Tree_For_C := True; Unnest_Subprogram_Mode := True; + Building_Static_Dispatch_Tables := False; Minimize_Expression_With_Actions := True; Expand_Nonbinary_Modular_Ops := True;