diff mbox series

[Ada] Better error message for aliased formal and atomic actual

Message ID 20191213095502.GA14067@adacore.com
State New
Headers show
Series [Ada] Better error message for aliased formal and atomic actual | expand

Commit Message

Pierre-Marie de Rodat Dec. 13, 2019, 9:55 a.m. UTC
The C.6 (12/3) clause makes it illegal to pass an atomic actual
parameter in a call corresponding to an aliased formal with a nonatomic
type.

This illegal case had been accepted up recently and started only to be
rejected as a by-product of the implementation of the C.6 (19) clause,
but the error message is confusing.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-12-13  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_res.adb (Resolve_Actuals): Give canonical error for
	illegal case of atomic/volatile parameter also if the formal is
	aliased.
diff mbox series

Patch

--- gcc/ada/sem_res.adb
+++ gcc/ada/sem_res.adb
@@ -4717,7 +4717,7 @@  package body Sem_Res is
 
             --  Check bad case of atomic/volatile argument (RM C.6(12))
 
-            if Is_By_Reference_Type (Etype (F))
+            if (Is_By_Reference_Type (Etype (F)) or else Is_Aliased (F))
               and then Comes_From_Source (N)
             then
                if Is_Atomic_Object (A)