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

--- Comment #7 from Liam Powell <liam at liampwll dot com> ---
Created attachment 63570
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63570&action=edit
possible fix

I think I've fixed this, refer to attached patch. Previous comment appears
unrelated but I'm still not sure if it's correct or not.

The issue here is that any level of ATC may raise an Abort_Signal, but
Build_Abort_Block always assumes that a caught Abort_Signal belongs to the
innermost ATC. All the runtime work for tracking ATC levels is in place with
Pending_ATC_Level and ATC_Nesting_Level so the fix here is straightforward:
Just add a procedure to the runtime which raises Abort_Signal if
Pending_ATC_Level < ATC_Nesting_Level and call it from the Build_Abort_Block
exception handler.

I've placed this procedure inside System.Tasking.Stages, which is almost
certainly the wrong place, but I don't know what the right place is.

Testing with the examples above: The first example prints nothing, as you'd
expect. The second example prints AB and does not raise a Tasking_Error, which
I'm pretty sure is correct but I have not dug in to the RM to check.

Reply via email to