2011-09-05 Bob Duff <duff@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Sep 2011 12:58:26 +0000 (12:58 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 5 Sep 2011 12:58:26 +0000 (12:58 +0000)
* sem_res.adb (Resolve_Intrinsic_Operator): Use unchecked
conversions instead of normal type conversions in all cases where a
type conversion would be illegal. In particular, use unchecked
conversions when the operand types are private.

2011-09-05  Johannes Kanig  <kanig@adacore.com>

* lib-xref-alfa.adb (Is_Alfa_Reference): Never declare effects on
objects of task type or protected type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178531 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/lib-xref-alfa.adb
gcc/ada/sem_res.adb

index 2bfd148..05246c4 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-05  Bob Duff  <duff@adacore.com>
+
+       * sem_res.adb (Resolve_Intrinsic_Operator): Use unchecked
+       conversions instead of normal type conversions in all cases where a
+       type conversion would be illegal. In particular, use unchecked
+       conversions when the operand types are private.
+
+2011-09-05  Johannes Kanig  <kanig@adacore.com>
+
+       * lib-xref-alfa.adb (Is_Alfa_Reference): Never declare effects on
+       objects of task type or protected type.
+
 2011-09-05  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_ch6.adb (Analyze_Expression_Function): If the expression
index ce95463..a2ea0e6 100644 (file)
@@ -620,7 +620,22 @@ package body Alfa is
                   return False;
 
                when others =>
+
+                  --  Objects of Task type or protected type are not Alfa
+                  --  references.
+
+                  if Present (Etype (E)) then
+                     case Ekind (Etype (E)) is
+                        when E_Task_Type | E_Protected_Type =>
+                           return False;
+
+                        when others =>
+                           null;
+                     end case;
+                  end if;
+
                   return Typ = 'r' or else Typ = 'm';
+
             end case;
          end Is_Alfa_Reference;
 
index 0a15075..1d3c018 100644 (file)
@@ -7145,6 +7145,8 @@ package body Sem_Res is
          return Res;
       end Convert_Operand;
 
+      --  Start of processing for Resolve_Intrinsic_Operator
+
    begin
       --  We must preserve the original entity in a generic setting, so that
       --  the legality of the operation can be verified in an instance.
@@ -7162,11 +7164,14 @@ package body Sem_Res is
       Set_Entity (N, Op);
       Set_Is_Overloaded (N, False);
 
-      --  If the operand type is private, rewrite with suitable conversions on
-      --  the operands and the result, to expose the proper underlying numeric
-      --  type.
+      --  If the result or operand types are private, rewrite with unchecked
+      --  conversions on the operands and the result, to expose the proper
+      --  underlying numeric type.
 
-      if Is_Private_Type (Typ) then
+      if Is_Private_Type (Typ)
+        or else Is_Private_Type (Etype (Left_Opnd (N)))
+        or else Is_Private_Type (Etype (Right_Opnd (N)))
+      then
          Arg1 := Convert_Operand (Left_Opnd (N));
          --  Unchecked_Convert_To (Btyp, Left_Opnd  (N));