Skip to content

Commit c013228

Browse files
author
Eric Botcazou
committed
Ada: Fix explicit raise on subtype of lock-free protected type
The issue is that the Uses_Lock_Free flag is not propagated to the subtype. gcc/ada/ * sem_ch3.adb (Analyze_Subtype_Declaration) <Concurrent_Kind>: Propagate the Uses_Lock_Free flag for protected types. gcc/testsuite/ * gnat.dg/protected_subtype1.adb: New test.
1 parent 8836210 commit c013228

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

gcc/ada/sem_ch3.adb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6145,6 +6145,10 @@ package body Sem_Ch3 is
61456145
Set_Is_Tagged_Type (Id, Is_Tagged_Type (T));
61466146
Set_Last_Entity (Id, Last_Entity (T));
61476147

6148+
if Is_Protected_Type (T) then
6149+
Set_Uses_Lock_Free (Id, Uses_Lock_Free (T));
6150+
end if;
6151+
61486152
if Is_Tagged_Type (T) then
61496153
Set_No_Tagged_Streams_Pragma
61506154
(Id, No_Tagged_Streams_Pragma (T));
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
-- { dg-do compile }
2+
3+
procedure Protected_Subtype1 is
4+
5+
protected type Object with Lock_Free => True is
6+
end Object;
7+
8+
protected body Object is
9+
end Object;
10+
11+
A : Object;
12+
13+
subtype Object_Subtype is Object;
14+
15+
B : Object_Subtype;
16+
17+
type Rec is record
18+
A : Object;
19+
B : Object_Subtype;
20+
end record;
21+
22+
C : Rec;
23+
24+
begin
25+
null;
26+
end;

0 commit comments

Comments
 (0)