aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-10-21 10:20:06 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-10-21 10:20:06 +0000
commit3c28a5f48c173ca546369b2434c0701009320569 (patch)
tree6335004f876cd0c17ec3b49656a9db78f4e4860f /gcc/ada
parent9a1c0fd9f2a59bbbfb4801064bf7cad898389e70 (diff)
downloadgcc-3c28a5f48c173ca546369b2434c0701009320569.zip
gcc-3c28a5f48c173ca546369b2434c0701009320569.tar.gz
gcc-3c28a5f48c173ca546369b2434c0701009320569.tar.bz2
decl.c (build_subst_list): Convert the expression of the constraint to the type of the discriminant.
* gcc-interfaces/decl.c (build_subst_list): Convert the expression of the constraint to the type of the discriminant. From-SVN: r153054
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/decl.c16
2 files changed, 15 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5d69cee..e4761d8 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2009-10-21 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interfaces/decl.c (build_subst_list): Convert the expression of
+ the constraint to the type of the discriminant.
+
+2009-10-21 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interfaces/decl.c (gnat_to_gnu_entity): Do not create a new
TYPE_DECL when a type is padded if there is already one and reset
TYPE_STUB_DECL in this case.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 70ced84..d0b52f2 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -7374,12 +7374,16 @@ build_subst_list (Entity_Id gnat_subtype, Entity_Id gnat_type, bool definition)
gnat_value = Next_Elmt (gnat_value))
/* Ignore access discriminants. */
if (!Is_Access_Type (Etype (Node (gnat_value))))
- gnu_list = tree_cons (gnat_to_gnu_field_decl (gnat_discrim),
- elaborate_expression
- (Node (gnat_value), gnat_subtype,
- get_entity_name (gnat_discrim), definition,
- true, false),
- gnu_list);
+ {
+ tree gnu_field = gnat_to_gnu_field_decl (gnat_discrim);
+ gnu_list = tree_cons (gnu_field,
+ convert (TREE_TYPE (gnu_field),
+ elaborate_expression
+ (Node (gnat_value), gnat_subtype,
+ get_entity_name (gnat_discrim),
+ definition, true, false)),
+ gnu_list);
+ }
return gnu_list;
}