https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124225

--- Comment #4 from Liam Powell <liam at liampwll dot com> ---
To save a couple of minutes for anyone who does attempt to fix this one day:

1. Write_Lock obviously needs to go below the null check.

2. An atomic won't work on all platforms due to protected pointers being 2
pointers internally.

3. If the ability to make protected pointers atomic on all platforms is ever
restored then obviously that solves the memory corruption issues and there's a
way to make this much more robust without locks:

@@ -1055,8 +1055,8 @@ package body System.Tasking.Stages is
          --  If there is a fall back handler, store its pointer for later
          --  execution.

-         if ID.Common.Fall_Back_Handler /= null then
-            TH := ID.Common.Fall_Back_Handler;
+         TH := ID.Common.Fall_Back_Handler;
+         if TH /= null then

There's still some weird edge cases there if the user is moving the fallback
handler between levels but it is strictly more robust then the old version.

Reply via email to