summaryrefslogtreecommitdiff
path: root/gcc/ada/s-stoele.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/s-stoele.adb')
-rw-r--r--gcc/ada/s-stoele.adb16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/ada/s-stoele.adb b/gcc/ada/s-stoele.adb
index fc69d1e1db8..cf81d579a9e 100644
--- a/gcc/ada/s-stoele.adb
+++ b/gcc/ada/s-stoele.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992,1993,1994 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2004 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- --
@@ -43,31 +43,33 @@ package body System.Storage_Elements is
function "+" (Left : Address; Right : Storage_Offset) return Address is
begin
- return Left + To_Address (Right);
+ return To_Address (To_Integer (Left) + To_Integer (To_Address (Right)));
end "+";
function "+" (Left : Storage_Offset; Right : Address) return Address is
begin
- return To_Address (Left) + Right;
+ return To_Address (To_Integer (To_Address (Left)) + To_Integer (Right));
end "+";
function "-" (Left : Address; Right : Storage_Offset) return Address is
begin
- return Left - To_Address (Right);
+ return To_Address (To_Integer (Left) - To_Integer (To_Address (Right)));
end "-";
function "-" (Left, Right : Address) return Storage_Offset is
begin
- return To_Offset (Left - Right);
+ return To_Offset (To_Address (To_Integer (Left) - To_Integer (Right)));
end "-";
function "mod" (Left : Address; Right : Storage_Offset)
return Storage_Offset is
begin
if Right >= 0 then
- return Storage_Offset (Address'(Left mod Address (Right)));
+ return Storage_Offset
+ (To_Integer (Left) mod Integer_Address (Right));
else
- return -Storage_Offset (Address'(Left mod Address (-Right)));
+ return -Storage_Offset
+ (To_Integer (Left) mod Integer_Address (-Right));
end if;
end "mod";