* exp_intr.adb: Minor code reorganization (use UI_Max)
* sem_intr.adb: use underlying type to check legality.
* einfo.adb (Known_Static_Esize): False for generic types
(Known_Static_RM_Size): False for generic types
* einfo.ads (Known_Static_Esize): False for generic types
(Known_Static_RM_Size): False for generic types
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160930
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-06-17 Robert Dewar <dewar@adacore.com>
+ * exp_intr.adb: Minor code reorganization (use UI_Max)
+ * sem_intr.adb: use underlying type to check legality.
+ * einfo.adb (Known_Static_Esize): False for generic types
+ (Known_Static_RM_Size): False for generic types
+ * einfo.ads (Known_Static_Esize): False for generic types
+ (Known_Static_RM_Size): False for generic types
+
+2010-06-17 Robert Dewar <dewar@adacore.com>
+
* exp_ch4.ads: Minor code reorganization (specs in alpha order).
2010-06-17 Robert Dewar <dewar@adacore.com>
function Known_Static_Esize (E : Entity_Id) return B is
begin
- return Uint12 (E) > Uint_0;
+ return Uint12 (E) > Uint_0
+ and then not Is_Generic_Type (E);
end Known_Static_Esize;
function Known_Static_Normalized_First_Bit (E : Entity_Id) return B is
function Known_Static_RM_Size (E : Entity_Id) return B is
begin
- return Uint13 (E) > Uint_0
- or else Is_Discrete_Type (E)
- or else Is_Fixed_Point_Type (E);
+ return (Uint13 (E) > Uint_0
+ or else Is_Discrete_Type (E)
+ or else Is_Fixed_Point_Type (E))
+ and then not Is_Generic_Type (E);
end Known_Static_RM_Size;
function Unknown_Alignment (E : Entity_Id) return B is
-- value is always known static for discrete types (and no other types can
-- have an RM_Size value of zero).
+ -- In two cases, Known_Static_Esize and Known_Static_RM_Size, there is one
+ -- more consideration, which is that we always return false for generic
+ -- types. Within a template, the size can look known, because of the fake
+ -- size values we put in template types, but they are not really known and
+ -- anyone testing if they are known within the template should get False as
+ -- a result to prevent incorrect assumptions.
+
function Known_Alignment (E : Entity_Id) return B;
function Known_Component_Bit_Offset (E : Entity_Id) return B;
function Known_Component_Size (E : Entity_Id) return B;
TR : constant Entity_Id := Etype (N);
T3 : Entity_Id;
Res : Node_Id;
- Siz : Uint;
+
+ Siz : constant Uint := UI_Max (Esize (T1), Esize (T2));
+ -- Maximum of operand sizes
begin
- if Esize (T1) > Esize (T2) then
- Siz := Esize (T1);
- else
- Siz := Esize (T2);
- end if;
+ -- Use Unsigned_32 for sizes of 32 or below, else Unsigned_64
if Siz > 32 then
T3 := RTE (RE_Unsigned_64);
T3 := RTE (RE_Unsigned_32);
end if;
+ -- Copy operator node, and reset type and entity fields, for
+ -- subsequent reanalysis.
+
Res := New_Copy (N);
Set_Etype (Res, Empty);
Set_Entity (Res, Empty);
+ -- Convert operands to large enough intermediate type
+
Set_Left_Opnd (Res,
- Unchecked_Convert_To (T3, Relocate_Node (Left_Opnd (N))));
+ Unchecked_Convert_To (T3, Relocate_Node (Left_Opnd (N))));
Set_Right_Opnd (Res,
- Unchecked_Convert_To (T3, Relocate_Node (Right_Opnd (N))));
+ Unchecked_Convert_To (T3, Relocate_Node (Right_Opnd (N))));
+
+ -- Analyze and resolve result formed by conversion to target type
Rewrite (N, Unchecked_Convert_To (TR, Res));
Analyze_And_Resolve (N, TR);
return;
end if;
- if not Is_Numeric_Type (T1) then
+ if not Is_Numeric_Type (Underlying_Type (T1)) then
Errint ("intrinsic operator can only apply to numeric types", E, N);
end if;
end Check_Intrinsic_Operator;