[Ada] Workaround for PR ada/80590

Message ID 20190617073728.GA31485@adacore.com
State New
Headers show
Series
  • [Ada] Workaround for PR ada/80590
Related show

Commit Message

Arnaud Charlet June 17, 2019, 7:37 a.m.
This patch avoids an unnecessary exception propagation in the compiler when
handling the "delay" construct. This should avoid the crashes/hangs observed
in PR 80590 on g-exptty.adb among others.

Note that the proper fix for this PR is to do a full bootstrap of GCC, since
the issue is that GNAT switched from SJLJ to ZCX exception handling from
GCC 7 to GCC 8, causing these inconsistencies that can only be resolved via
a full bootstrap, or by using the newly built compiler to build new compilers.

Tested on x86_64-pc-linux-gnu

Verified manually that no exception propagation occurs in gnat1 with this
patch when compiling g-exptty.adb, g-locfil.adb, s-gloloc.adb and g-socthi.adb.

Tom, if you could confirm that you are unblocked and can move forward on
reenabling Ada on your builds, that'd be great, let me know.

Committed on branches 8, 9 and trunk.

2019-06-17  Arnaud Charlet  <charlet@adacore.com>

PR ada/80590

	* exp_ch9.adb (Expand_N_Delay_Relative_Statement): Swap the two
	conditions to avoid a unnecessary exception propagation in the default
	case.

--

Patch

Index: exp_ch9.adb
===================================================================
--- exp_ch9.adb	(revision 272370)
+++ exp_ch9.adb	(working copy)
@@ -8258,18 +8258,17 @@ 
       Proc : Entity_Id;
 
    begin
-      --  Try to use System.Relative_Delays.Delay_For only if available. This
-      --  is the implementation used on restricted platforms when Ada.Calendar
-      --  is not available.
+      --  Try to use Ada.Calendar.Delays.Delay_For if available.
 
-      if RTE_Available (RO_RD_Delay_For) then
-         Proc := RTE (RO_RD_Delay_For);
+      if RTE_Available (RO_CA_Delay_For) then
+         Proc := RTE (RO_CA_Delay_For);
 
-      --  Otherwise, use Ada.Calendar.Delays.Delay_For and emit an error
-      --  message if not available.
+      --  Otherwise, use System.Relative_Delays.Delay_For and emit an error
+      --  message if not available. This is the implementation used on
+      --  restricted platforms when Ada.Calendar is not available.
 
       else
-         Proc := RTE (RO_CA_Delay_For);
+         Proc := RTE (RO_RD_Delay_For);
       end if;
 
       Rewrite (N,