aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorSimon Wright <simon@pushface.org>2017-12-06 09:42:57 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-12-06 09:42:57 +0000
commit40242256f156e91244d770ac422e6e244b99152b (patch)
tree629aaf14b54f142bdff3694de058759c03b4b9aa /gcc/ada
parent67acacee0ead9b8b68e3ae8c9cfbeda6f702d792 (diff)
downloadgcc-40242256f156e91244d770ac422e6e244b99152b.zip
gcc-40242256f156e91244d770ac422e6e244b99152b.tar.gz
gcc-40242256f156e91244d770ac422e6e244b99152b.tar.bz2
re PR ada/66205 (gnatbind generates invalid code when finalization is enabled in restricted runtime)
PR ada/66205 * bindgen.adb (Gen_AdaFinal): If the restriction No_Task_Termination is set, generate a null body. From-SVN: r255441
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/bindgen.adb12
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 2619b16..3168ba4 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-06 Simon Wright <simon@pushface.org>
+
+ PR ada/66205
+ * bindgen.adb (Gen_AdaFinal): If the restriction No_Task_Termination is
+ set, generate a null body.
+
2017-12-05 Piotr Trojanek <trojanek@adacore.com>
* sem_util.adb (Contains_Refined_State): Remove.
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index e3d875b..44d521e 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -450,6 +450,18 @@ package body Bindgen is
begin
WBI (" procedure " & Ada_Final_Name.all & " is");
+ -- If task termination is not allowed, as is the case in restricted
+ -- runtimes, such as Ravenscar or ZFP, but may not be the case for all
+ -- configurable runtimes, we do not need program-level finalization.
+
+ if Cumulative_Restrictions.Set (No_Task_Termination) then
+ WBI (" begin");
+ WBI (" null;");
+ WBI (" end " & Ada_Final_Name.all & ";");
+ WBI ("");
+ return;
+ end if;
+
-- Call s_stalib_adafinal to await termination of tasks and so on. We
-- want to do this if there is a main program, either in Ada or in some
-- other language. (Note that Bind_Main_Program is True for Ada mains,