summaryrefslogtreecommitdiff
path: root/gcc/ada/freeze.adb
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-27 07:51:59 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-27 07:51:59 +0000
commitcb56012690ae1b8f203a61decdcb5d281db2431c (patch)
tree58bc341cb04d6000b923fc1d7edb78289d9f2938 /gcc/ada/freeze.adb
parent84836637fcb8e7c3aea3b25f4cbf17a59cfca553 (diff)
downloadgcc-cb56012690ae1b8f203a61decdcb5d281db2431c.tar.gz
2009-07-27 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 150103 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@150104 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r--gcc/ada/freeze.adb29
1 files changed, 27 insertions, 2 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index b4cc4edd2f4..14ba41c9956 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -593,7 +593,7 @@ package body Freeze is
if RM_Size (T) < S then
Error_Msg_Uint_1 := S;
Error_Msg_NE
- ("size for & too small, minimum allowed is ^",
+ ("size for& too small, minimum allowed is ^",
Size_Clause (T), T);
elsif Unknown_Esize (T) then
@@ -2280,15 +2280,39 @@ package body Freeze is
end;
end if;
- -- See if Implicit_Packing would work
+ -- See if Size is too small as is (and implicit packing might help)
if not Is_Packed (Rec)
+
+ -- No implicit packing if even one component is explicitly placed
+
and then not Placed_Component
+
+ -- Must have size clause and all scalar components
+
and then Has_Size_Clause (Rec)
and then All_Scalar_Components
+
+ -- Do not try implicit packing on records with discriminants, too
+ -- complicated, especially in the variant record case.
+
and then not Has_Discriminants (Rec)
+
+ -- We can implicitly pack if the specified size of the record is
+ -- less than the sum of the object sizes (no point in packing if
+ -- this is not the case).
+
and then Esize (Rec) < Scalar_Component_Total_Esize
+
+ -- And the total RM size cannot be greater than the specified size
+ -- since otherwise packing will not get us where we have to be!
+
and then Esize (Rec) >= Scalar_Component_Total_RM_Size
+
+ -- Never do implicit packing in CodePeer mode since we don't do
+ -- any packing ever in this mode (why not???)
+
+ and then not CodePeer_Mode
then
-- If implicit packing enabled, do it
@@ -3007,6 +3031,7 @@ package body Freeze is
and then not Is_Limited_Composite (E)
and then not Is_Packed (Root_Type (E))
and then not Has_Component_Size_Clause (Root_Type (E))
+ and then not CodePeer_Mode
then
Get_Index_Bounds (First_Index (E), Lo, Hi);