aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_res.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2008-08-04 14:51:00 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-08-04 14:51:00 +0200
commit9fa33291c780a0d1d3bef0c0aa4650fa6829ade3 (patch)
tree33ff3310a71a557b34d9aa121030ffefc9ccd204 /gcc/ada/sem_res.adb
parent31e845120a7e947a0430e1b745b5873311ac9ab9 (diff)
downloadgcc-9fa33291c780a0d1d3bef0c0aa4650fa6829ade3.zip
gcc-9fa33291c780a0d1d3bef0c0aa4650fa6829ade3.tar.gz
gcc-9fa33291c780a0d1d3bef0c0aa4650fa6829ade3.tar.bz2
2008-08-04 Robert Dewar <dewar@adacore.com>
* sem_res.adb: (Valid_Conversion): Catch case of designated types having different sizes, even though they statically match. From-SVN: r138615
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r--gcc/ada/sem_res.adb22
1 files changed, 21 insertions, 1 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index d59c30b..4e0e0de 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -9519,7 +9519,27 @@ package body Sem_Res is
(not Is_Constrained (Opnd)
or else not Is_Constrained (Target)))
then
- return True;
+ -- Special case, if Value_Size has been used to make the
+ -- sizes different, the conversion is not allowed even
+ -- though the subtypes statically match.
+
+ if Known_Static_RM_Size (Target)
+ and then Known_Static_RM_Size (Opnd)
+ and then RM_Size (Target) /= RM_Size (Opnd)
+ then
+ Error_Msg_NE
+ ("target designated subtype not compatible with }",
+ N, Opnd);
+ Error_Msg_NE
+ ("\because sizes of the two designated subtypes differ",
+ N, Opnd);
+ return False;
+
+ -- Normal case where conversion is allowed
+
+ else
+ return True;
+ end if;
else
Error_Msg_NE