X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fada%2Fexp_util.adb;h=e90c491b5544c4cd75bb52dad6ef44464eb2906e;hb=80d4fec446bcdba9588f2a861b2ddd449fb48292;hp=e38bcce3bafbbacdf405107249e8c2998142c2e2;hpb=d9f1f85c05be9b82743f471d36fc67093e5517a1;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index e38bcce3baf..e90c491b554 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -2384,6 +2384,34 @@ package body Exp_Util is --------------------------------- function Is_Possibly_Unaligned_Slice (P : Node_Id) return Boolean is + + function Has_Non_Trivial_Component_Clause (E : Entity_Id) return Boolean; + -- Check whether the component clause might place the component at an + -- alignment that will require the use of a copy when a slice is passed + -- as a parameter. The code is conservative because at this point the + -- expander does not know the alignment choice that the back-end will + -- make. For now we return true if the component is not the first one + -- in the enclosing record. This routine is a place holder for further + -- analysis of this kind. + + -------------------------------------- + -- Has_Non_Trivial_Component_Clause -- + -------------------------------------- + + function Has_Non_Trivial_Component_Clause (E : Entity_Id) return Boolean + is + Rep_Clause : constant Node_Id := Component_Clause (E); + begin + if No (Rep_Clause) then + return False; + else + return Intval (Position (Rep_Clause)) /= Uint_0 + or else Intval (First_Bit (Rep_Clause)) /= Uint_0; + end if; + end Has_Non_Trivial_Component_Clause; + + -- Start of processing for Is_Possibly_Unaligned_Slice + begin -- ??? GCC3 will eventually handle strings with arbitrary alignments, -- but for now the following check must be disabled. @@ -2448,7 +2476,8 @@ package body Exp_Util is or else Known_Alignment (Etype (Prefix (Pref))) or else - Present (Component_Clause (Entity (Selector_Name (Pref))))); + Has_Non_Trivial_Component_Clause + (Entity (Selector_Name (Pref)))); end; end Is_Possibly_Unaligned_Slice;