diff options
-rw-r--r-- | gcc/ada/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ada/einfo.adb | 10 | ||||
-rw-r--r-- | gcc/ada/einfo.ads | 7 | ||||
-rw-r--r-- | gcc/ada/exp_intr.adb | 21 | ||||
-rw-r--r-- | gcc/ada/sem_intr.adb | 2 |
5 files changed, 36 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 70105c9..275f160 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,14 @@ 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> diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb index da4ed38..5a6e8dd 100644 --- a/gcc/ada/einfo.adb +++ b/gcc/ada/einfo.adb @@ -5367,7 +5367,8 @@ package body Einfo is 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 @@ -5390,9 +5391,10 @@ package body Einfo 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 diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads index 99c7141..12a770f 100644 --- a/gcc/ada/einfo.ads +++ b/gcc/ada/einfo.ads @@ -6188,6 +6188,13 @@ package Einfo 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; diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb index 95a063c..09242c2 100644 --- a/gcc/ada/exp_intr.adb +++ b/gcc/ada/exp_intr.adb @@ -122,14 +122,12 @@ package body Exp_Intr is 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); @@ -137,14 +135,21 @@ package body Exp_Intr is 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); diff --git a/gcc/ada/sem_intr.adb b/gcc/ada/sem_intr.adb index 63cecbd..add170f 100644 --- a/gcc/ada/sem_intr.adb +++ b/gcc/ada/sem_intr.adb @@ -285,7 +285,7 @@ package body Sem_Intr is 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; |