diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2020-10-31 00:01:43 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-09-05 09:21:00 +0200 |
commit | c7dd10e8af0e71a901af1f0b06d2216d5e31d586 (patch) | |
tree | ced1d63e8a307a6e9052f42135fcd081a159476a | |
parent | 2af82bc2eb9b75d6f10aa0f48ad9489a8798416a (diff) | |
download | gcc-c7dd10e8af0e71a901af1f0b06d2216d5e31d586.zip gcc-c7dd10e8af0e71a901af1f0b06d2216d5e31d586.tar.gz gcc-c7dd10e8af0e71a901af1f0b06d2216d5e31d586.tar.bz2 |
[Ada] Fix expansion of attribute Priority
gcc/ada/
* exp_attr.adb (Expand_N_Attribute_Reference): Fix detection of the
enclosing protected type and of the enclosing protected subprogram.
* exp_ch5.adb (Expand_N_Assignment_Statement): Likewise.
-rw-r--r-- | gcc/ada/exp_attr.adb | 10 | ||||
-rw-r--r-- | gcc/ada/exp_ch5.adb | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index ad75453..c3e7fd21 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -5675,10 +5675,10 @@ package body Exp_Attr is RT_Subprg_Name : Node_Id; begin - -- Look for the enclosing concurrent type + -- Look for the enclosing protected type Conctyp := Current_Scope; - while not Is_Concurrent_Type (Conctyp) loop + while not Is_Protected_Type (Conctyp) loop Conctyp := Scope (Conctyp); end loop; @@ -5687,13 +5687,15 @@ package body Exp_Attr is -- Generate the actual of the call Subprg := Current_Scope; - while not Present (Protected_Body_Subprogram (Subprg)) loop + while not (Is_Subprogram_Or_Entry (Subprg) + and then Present (Protected_Body_Subprogram (Subprg))) + loop Subprg := Scope (Subprg); end loop; -- Use of 'Priority inside protected entries and barriers (in both -- cases the type of the first formal of their expanded subprogram - -- is Address) + -- is Address). if Etype (First_Entity (Protected_Body_Subprogram (Subprg))) = RTE (RE_Address) diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb index 9a2a110..382302c 100644 --- a/gcc/ada/exp_ch5.adb +++ b/gcc/ada/exp_ch5.adb @@ -2416,10 +2416,10 @@ package body Exp_Ch5 is if Is_Expanded_Priority_Attribute (Ent) then - -- Look for the enclosing concurrent type + -- Look for the enclosing protected type Conctyp := Current_Scope; - while not Is_Concurrent_Type (Conctyp) loop + while not Is_Protected_Type (Conctyp) loop Conctyp := Scope (Conctyp); end loop; @@ -2428,7 +2428,10 @@ package body Exp_Ch5 is -- Generate the first actual of the call Subprg := Current_Scope; - while not Present (Protected_Body_Subprogram (Subprg)) loop + while + not (Is_Subprogram_Or_Entry (Subprg) + and then Present (Protected_Body_Subprogram (Subprg))) + loop Subprg := Scope (Subprg); end loop; |