diff options
author | Javier Miranda <miranda@adacore.com> | 2020-08-06 13:56:50 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-21 03:22:47 -0400 |
commit | f1722339efa953eed5c69ec8869fc62b41e72ee4 (patch) | |
tree | 611f009f53656e70b13c2f738bc3cdf56ba528df | |
parent | d0d9f29d52e134c02fafee222be655189d9050f2 (diff) | |
download | gcc-f1722339efa953eed5c69ec8869fc62b41e72ee4.zip gcc-f1722339efa953eed5c69ec8869fc62b41e72ee4.tar.gz gcc-f1722339efa953eed5c69ec8869fc62b41e72ee4.tar.bz2 |
[Ada] Wrong detection of potentially blocking call in protected object
gcc/ada/
* exp_ch9.adb (Build_Task_Activation_Call): Do not generate a
call to activate tasks if we are within the scope of a protected
type and pragma Detect_Blocking is active.
-rw-r--r-- | gcc/ada/exp_ch9.adb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 26e7321..f56b746 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -4960,6 +4960,18 @@ package body Exp_Ch9 is if No (Chain) or else Is_Ignored_Ghost_Entity (Chain) then return; + + -- The availability of the activation chain entity does not ensure + -- that we have tasks to activate because it may have been declared + -- by the frontend to pass a required extra formal to a build-in-place + -- subprogram call. If we are within the scope of a protected type and + -- pragma Detect_Blocking is active we can assume that no tasks will be + -- activated; if tasks are created in a protected object and this pragma + -- is active then the frontend emits a warning and Program_Error is + -- raised at runtime. + + elsif Detect_Blocking and then Within_Protected_Type (Current_Scope) then + return; end if; -- The location of the activation call must be as close as possible to |