Commit d39f6b24 by Yannick Moy Committed by Pierre-Marie de Rodat

[Ada] More precise handling of Size/Object_Size in GNATprove

GNATprove does a partial expansion which did not allow getting the
most precise value for attributes Size/Object_Size. Now fixed.

There is no impact on compilation.

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

gcc/ada/

	* exp_attr.adb, exp_attr.ads (Expand_Size_Attribute): New
	procedure to share part of the attribute expansion with
	GNATprove mode.
	(Expand_N_Attribute_Reference): Extract part of the
	Size/Object_Size expansion in the new procedure
	Expand_Size_Attribute.
	* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Expand
	Size/Object_Size attributes using the new procedure
	Expand_Size_Attribute.

From-SVN: r274290
parent 08c8696d
2019-08-12 Yannick Moy <moy@adacore.com> 2019-08-12 Yannick Moy <moy@adacore.com>
* exp_attr.adb, exp_attr.ads (Expand_Size_Attribute): New
procedure to share part of the attribute expansion with
GNATprove mode.
(Expand_N_Attribute_Reference): Extract part of the
Size/Object_Size expansion in the new procedure
Expand_Size_Attribute.
* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Expand
Size/Object_Size attributes using the new procedure
Expand_Size_Attribute.
2019-08-12 Yannick Moy <moy@adacore.com>
* exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Only * exp_spark.adb (Expand_SPARK_N_Attribute_Reference): Only
expand Enum_Rep attribute when its parameter is a literal. expand Enum_Rep attribute when its parameter is a literal.
......
...@@ -31,4 +31,9 @@ package Exp_Attr is ...@@ -31,4 +31,9 @@ package Exp_Attr is
procedure Expand_N_Attribute_Reference (N : Node_Id); procedure Expand_N_Attribute_Reference (N : Node_Id);
procedure Expand_Size_Attribute (N : Node_Id);
-- Handles part of the expansion of attributes 'Object_Size, 'Size,
-- 'Value_Size, and 'VADS_Size, so that it can also be used in the special
-- expansion in GNATprove mode.
end Exp_Attr; end Exp_Attr;
...@@ -227,6 +227,13 @@ package body Exp_SPARK is ...@@ -227,6 +227,13 @@ package body Exp_SPARK is
end if; end if;
end; end;
elsif Attr_Id = Attribute_Object_Size
or else Attr_Id = Attribute_Size
or else Attr_Id = Attribute_Value_Size
or else Attr_Id = Attribute_VADS_Size
then
Exp_Attr.Expand_Size_Attribute (N);
-- For attributes which return Universal_Integer, introduce a conversion -- For attributes which return Universal_Integer, introduce a conversion
-- to the expected type with the appropriate check flags set. -- to the expected type with the appropriate check flags set.
...@@ -241,10 +248,6 @@ package body Exp_SPARK is ...@@ -241,10 +248,6 @@ package body Exp_SPARK is
or else Attr_Id = Attribute_Pos or else Attr_Id = Attribute_Pos
or else Attr_Id = Attribute_Position or else Attr_Id = Attribute_Position
or else Attr_Id = Attribute_Range_Length or else Attr_Id = Attribute_Range_Length
or else Attr_Id = Attribute_Object_Size
or else Attr_Id = Attribute_Size
or else Attr_Id = Attribute_Value_Size
or else Attr_Id = Attribute_VADS_Size
or else Attr_Id = Attribute_Aft or else Attr_Id = Attribute_Aft
or else Attr_Id = Attribute_Max_Alignment_For_Allocation or else Attr_Id = Attribute_Max_Alignment_For_Allocation
then then
......
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