aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/layout.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/layout.adb')
-rw-r--r--gcc/ada/layout.adb13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/ada/layout.adb b/gcc/ada/layout.adb
index 9b6c0ce..c026dfe 100644
--- a/gcc/ada/layout.adb
+++ b/gcc/ada/layout.adb
@@ -3103,11 +3103,22 @@ package body Layout is
-- the type, or the maximum allowed alignment.
declare
- S : constant Int := UI_To_Int (Esize (E)) / SSU;
+ S : Int;
+
A : Nat;
Max_Alignment : Nat;
begin
+ -- The given esize may be larger that int'last because of a previous
+ -- error, and the call to UI_To_Int will fail, so use default.
+
+ if Esize (E) / SSU > Ttypes.Maximum_Alignment then
+ S := Ttypes.Maximum_Alignment;
+
+ else
+ S := UI_To_Int (Esize (E)) / SSU;
+ end if;
+
-- If the default alignment of "double" floating-point types is
-- specifically capped, enforce the cap.