Commit 9d792131 by Yannick Moy Committed by Pierre-Marie de Rodat

[Ada] Fix spurious ownership error in GNATprove

Like Is_Path_Expression, function Is_Subpath_Expression should consider
the possibility that the subpath is a type conversion or type
qualification over the actual subpath node. This avoids spurious
ownership errors in GNATprove.

There is no impact on compilation.

2019-08-14  Yannick Moy  <moy@adacore.com>

gcc/ada/

	* sem_spark.adb (Is_Subpath_Expression): Take into account
	conversion and qualification.

From-SVN: r274452
parent ebe1a04f
2019-08-14 Yannick Moy <moy@adacore.com>
* sem_spark.adb (Is_Subpath_Expression): Take into account
conversion and qualification.
2019-08-14 Eric Botcazou <ebotcazou@adacore.com> 2019-08-14 Eric Botcazou <ebotcazou@adacore.com>
* sem_ch7.adb (Install_Private_Declarations) * sem_ch7.adb (Install_Private_Declarations)
......
...@@ -4266,6 +4266,12 @@ package body Sem_SPARK is ...@@ -4266,6 +4266,12 @@ package body Sem_SPARK is
is is
begin begin
return Is_Path_Expression (Expr, Is_Traversal) return Is_Path_Expression (Expr, Is_Traversal)
or else (Nkind_In (Expr, N_Qualified_Expression,
N_Type_Conversion,
N_Unchecked_Type_Conversion)
and then Is_Subpath_Expression (Expression (Expr)))
or else (Nkind (Expr) = N_Attribute_Reference or else (Nkind (Expr) = N_Attribute_Reference
and then and then
(Get_Attribute_Id (Attribute_Name (Expr)) = (Get_Attribute_Id (Attribute_Name (Expr)) =
...@@ -4276,7 +4282,8 @@ package body Sem_SPARK is ...@@ -4276,7 +4282,8 @@ package body Sem_SPARK is
or else or else
Get_Attribute_Id (Attribute_Name (Expr)) = Get_Attribute_Id (Attribute_Name (Expr)) =
Attribute_Image)) Attribute_Image))
or else Nkind (Expr) = N_Op_Concat;
or else Nkind (Expr) = N_Op_Concat;
end Is_Subpath_Expression; end Is_Subpath_Expression;
--------------------------- ---------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment