OSDN Git Service

2006-02-13 Thomas Quinot <quinot@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Feb 2006 09:39:54 +0000 (09:39 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Feb 2006 09:39:54 +0000 (09:39 +0000)
* exp_pakd.ads: Fix typos in comments.

* exp_pakd.adb (Convert_To_PAT_Type): For the case of a bit packed
array reference that is an explicit dereference, mark the converted
(packed) array reference as analyzed to prevent a forthcoming
reanalysis from resetting its type to the original (non-packed) array
type.

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

gcc/ada/exp_pakd.adb
gcc/ada/exp_pakd.ads

index 5b0a10a..7c84a6d 100644 (file)
@@ -674,7 +674,7 @@ package body Exp_Pakd is
 
    --  The PAT is always obtained from the actual subtype
 
-   procedure Convert_To_PAT_Type (Aexp : Entity_Id) is
+   procedure Convert_To_PAT_Type (Aexp : Node_Id) is
       Act_ST : Entity_Id;
 
    begin
@@ -682,18 +682,18 @@ package body Exp_Pakd is
       Act_ST := Underlying_Type (Etype (Aexp));
       Create_Packed_Array_Type (Act_ST);
 
-      --  Just replace the etype with the packed array type. This works
+      --  Just replace the eEype with the packed array type. This works
       --  because the expression will not be further analyzed, and Gigi
       --  considers the two types equivalent in any case.
 
-      --  This is not strictly the case ??? If the reference is an actual
-      --  in a call, the expansion of the prefix is delayed, and must be
-      --  reanalyzed, see Reset_Packed_Prefix. On the other hand, if the
-      --  prefix is a simple array reference, reanalysis can produce spurious
-      --  type errors when the PAT type is replaced again with the original
-      --  type of the array. The following is correct and minimal, but the
-      --  handling of more complex packed expressions in actuals is confused.
-      --  It is likely that the problem only remains for actuals in calls.
+      --  This is not strictly the case ??? If the reference is an actual in
+      --  call, the expansion of the prefix is delayed, and must be reanalyzed,
+      --  see Reset_Packed_Prefix. On the other hand, if the prefix is a simple
+      --  array reference, reanalysis can produce spurious type errors when the
+      --  PAT type is replaced again with the original type of the array. Same
+      --  for the case of a dereference. The following is correct and minimal,
+      --  but the handling of more complex packed expressions in actuals is
+      --  confused. Probably the problem only remains for actuals in calls.
 
       Set_Etype (Aexp, Packed_Array_Type (Act_ST));
 
@@ -701,6 +701,7 @@ package body Exp_Pakd is
         or else
            (Nkind (Aexp) = N_Indexed_Component
              and then Is_Entity_Name (Prefix (Aexp)))
+        or else Nkind (Aexp) = N_Explicit_Dereference
       then
          Set_Analyzed (Aexp);
       end if;
@@ -2584,7 +2585,7 @@ package body Exp_Pakd is
       Csiz := Component_Size (Atyp);
 
       Convert_To_PAT_Type (Obj);
-      PAT  := Etype (Obj);
+      PAT := Etype (Obj);
 
       Cmask := 2 ** Csiz - 1;
 
index a57b0b3..bd00459 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2004 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2005, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -237,8 +237,8 @@ package Exp_Pakd is
    procedure Expand_Packed_Element_Reference (N : Node_Id);
    --  N is an N_Indexed_Component node whose prefix is a packed array. In
    --  the bit packed case, this routine can only be used for the expression
-   --  evaluation case not the assignment case, since the result is not a
-   --  variable. See Expand_Bit_Packed_Element_Set for how he assignment case
+   --  evaluation case, not the assignment case, since the result is not a
+   --  variable. See Expand_Bit_Packed_Element_Set for how the assignment case
    --  is handled in the bit packed case. For the enumeration case, the result
    --  of this call is always a variable, so the call can be used for both the
    --  expression evaluation and assignment cases.