aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2018-01-11 08:52:47 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-01-11 08:52:47 +0000
commit78cac7386e2dc48ec5adb4ff0c9a94eed958c9fc (patch)
tree0569f97f50f57bf9a3f7ae6dcbc807d256daf6e8
parent210fef2d1c7b47c0587375d87d4f4a65f28ca57e (diff)
downloadgcc-78cac7386e2dc48ec5adb4ff0c9a94eed958c9fc.zip
gcc-78cac7386e2dc48ec5adb4ff0c9a94eed958c9fc.tar.gz
gcc-78cac7386e2dc48ec5adb4ff0c9a94eed958c9fc.tar.bz2
exp_util.adb (Remove_Side_Effects): No action done for functions returning class-wide types since it requires...
2018-01-11 Javier Miranda <miranda@adacore.com> 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
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/exp_util.adb10
-rw-r--r--gcc/ada/gnat1drv.adb1
3 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 9c104ec..0123986 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2018-01-11 Javier Miranda <miranda@adacore.com>
+
+ * 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 <trojanek@adacore.com>
* 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 86b57dc..000dc1d 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 eda994d..12ff49c 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;