diff options
Diffstat (limited to 'gcc/ada/exp_pakd.adb')
-rw-r--r-- | gcc/ada/exp_pakd.adb | 77 |
1 files changed, 41 insertions, 36 deletions
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb index c90409b..88f86f4 100644 --- a/gcc/ada/exp_pakd.adb +++ b/gcc/ada/exp_pakd.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2020, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2021, 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- -- @@ -23,33 +23,37 @@ -- -- ------------------------------------------------------------------------------ -with Atree; use Atree; -with Checks; use Checks; -with Einfo; use Einfo; -with Errout; use Errout; -with Exp_Dbug; use Exp_Dbug; -with Exp_Util; use Exp_Util; -with Layout; use Layout; -with Lib.Xref; use Lib.Xref; -with Namet; use Namet; -with Nlists; use Nlists; -with Nmake; use Nmake; -with Opt; use Opt; -with Sem; use Sem; -with Sem_Aux; use Sem_Aux; -with Sem_Ch3; use Sem_Ch3; -with Sem_Ch8; use Sem_Ch8; -with Sem_Ch13; use Sem_Ch13; -with Sem_Eval; use Sem_Eval; -with Sem_Res; use Sem_Res; -with Sem_Util; use Sem_Util; -with Sinfo; use Sinfo; -with Snames; use Snames; -with Stand; use Stand; -with Targparm; use Targparm; -with Tbuild; use Tbuild; -with Ttypes; use Ttypes; -with Uintp; use Uintp; +with Atree; use Atree; +with Checks; use Checks; +with Einfo; use Einfo; +with Einfo.Entities; use Einfo.Entities; +with Einfo.Utils; use Einfo.Utils; +with Errout; use Errout; +with Exp_Dbug; use Exp_Dbug; +with Exp_Util; use Exp_Util; +with Layout; use Layout; +with Lib.Xref; use Lib.Xref; +with Namet; use Namet; +with Nlists; use Nlists; +with Nmake; use Nmake; +with Opt; use Opt; +with Sem; use Sem; +with Sem_Aux; use Sem_Aux; +with Sem_Ch3; use Sem_Ch3; +with Sem_Ch8; use Sem_Ch8; +with Sem_Ch13; use Sem_Ch13; +with Sem_Eval; use Sem_Eval; +with Sem_Res; use Sem_Res; +with Sem_Util; use Sem_Util; +with Sinfo; use Sinfo; +with Sinfo.Nodes; use Sinfo.Nodes; +with Sinfo.Utils; use Sinfo.Utils; +with Snames; use Snames; +with Stand; use Stand; +with Targparm; use Targparm; +with Tbuild; use Tbuild; +with Ttypes; use Ttypes; +with Uintp; use Uintp; package body Exp_Pakd is @@ -559,11 +563,11 @@ package body Exp_Pakd is -- Do not reset RM_Size if already set, as happens in the case of -- a modular type. - if Unknown_Esize (PAT) then + if not Known_Esize (PAT) then Set_Esize (PAT, PASize); end if; - if Unknown_RM_Size (PAT) then + if not Known_RM_Size (PAT) then Set_RM_Size (PAT, PASize); end if; @@ -609,7 +613,7 @@ package body Exp_Pakd is -- type or component, take it into account. if Csize <= 2 or else Csize = 4 or else Csize mod 2 /= 0 - or else Alignment (Typ) = 1 + or else (Known_Alignment (Typ) and then Alignment (Typ) = 1) or else Component_Alignment (Typ) = Calign_Storage_Unit then if Reverse_Storage_Order (Typ) then @@ -619,7 +623,7 @@ package body Exp_Pakd is end if; elsif Csize mod 4 /= 0 - or else Alignment (Typ) = 2 + or else (Known_Alignment (Typ) and then Alignment (Typ) = 2) then if Reverse_Storage_Order (Typ) then PB_Type := RTE (RE_Rev_Packed_Bytes2); @@ -824,8 +828,8 @@ package body Exp_Pakd is elsif not Is_Constrained (Typ) then - -- When generating standard DWARF (i.e when GNAT_Encodings is - -- DWARF_GNAT_Encodings_Minimal), the ___XP suffix will be stripped + -- When generating standard DWARF (i.e when GNAT_Encodings is not + -- DWARF_GNAT_Encodings_All), the ___XP suffix will be stripped -- by the back-end but generate it anyway to ease compiler debugging. -- This will help to distinguish implementation types from original -- packed arrays. @@ -1909,9 +1913,10 @@ package body Exp_Pakd is -- where PAT is the packed array type. This works fine, since in the -- modular case we guarantee that the unused bits are always zeroes. -- We do have to compare the lengths because we could be comparing - -- two different subtypes of the same base type. + -- two different subtypes of the same base type. We can only do this + -- if the PATs on both sides are the same. - if Is_Modular_Integer_Type (PAT) then + if Is_Modular_Integer_Type (PAT) and then PAT = Etype (R) then Rewrite (N, Make_And_Then (Loc, Left_Opnd => |