Routine Analyze_External_Property_In_Decl_Part, which deals with pragmas
Async_Readers, Async_Writers, Effective_Reads, Effective_Writes,
returned early when the pragma has been already analyzed. When this
happened, its output parameter Expr_Val was set to False no matter what
the pragma argument was.
This was incorrect, especially since typically those pragmas are used
with no arguments, which implicitly means the argument is True. Now when
returning early the output parameter is set to the (implicit) argument
given by the pragma.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_prag.adb (Analyze_External_Property_In_Decl_Part): Set the
output parameter Expr_Val to the (implicit) pragma argument even
when returning early.
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -2101,12 +2101,11 @@ package body Sem_Prag is
Expr : Node_Id;
begin
- Expr_Val := False;
-
- -- Do not analyze the pragma multiple times
+ -- Do not analyze the pragma multiple times, but set the output
+ -- parameter to the argument specified by the pragma.
if Is_Analyzed_Pragma (N) then
- return;
+ goto Leave;
end if;
Error_Msg_Name_1 := Pragma_Name (N);
@@ -2147,6 +2146,10 @@ package body Sem_Prag is
end if;
end if;
+ Set_Is_Analyzed_Pragma (N);
+
+ <<Leave>>
+
-- Ensure that the Boolean expression (if present) is static. A missing
-- argument defaults the value to True (SPARK RM 7.1.2(5)).
@@ -2160,7 +2163,6 @@ package body Sem_Prag is
end if;
end if;
- Set_Is_Analyzed_Pragma (N);
end Analyze_External_Property_In_Decl_Part;
---------------------------------