aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/decl.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-08-13 12:24:46 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2004-08-13 12:24:46 +0200
commit244e5a2c23e5477e26f1970afb1fa0772b2cc808 (patch)
treec7c2be77cbb0fac9968fa1b4ce500bd59db9d31d /gcc/ada/decl.c
parent47d2cee50d64825872e97186da5a683dcabb5943 (diff)
downloadgcc-244e5a2c23e5477e26f1970afb1fa0772b2cc808.zip
gcc-244e5a2c23e5477e26f1970afb1fa0772b2cc808.tar.gz
gcc-244e5a2c23e5477e26f1970afb1fa0772b2cc808.tar.bz2
[multiple changes]
2004-08-13 Olivier Hainque <hainque@act-europe.fr> * decl.c (gnat_to_gnu_entity) <E_Variable>: When building an allocator for a global aliased object with a variable size and an unconstrained nominal subtype, pretend there is no initializer if the one we have is incomplete, and avoid referencing an inexistant component in there. The part we have will be rebuilt anyway and the reference may confuse further operations. 2004-08-13 Thomas Quinot <quinot@act-europe.fr> * einfo.ads: Minor reformatting * lib-writ.adb (Output_Main_Program_Line): Do not set parameter restrictions in the ALI if we only want to warn about violations. 2004-08-13 Vincent Celier <celier@gnat.com> * ali.adb (Scan_ALI): Initialize component Body_Needed_For_SAL to False when creating a new Unit_Record in table Units. * gnatls.adb (Output_Unit): In verbose mode, output the restrictions that are violated, if any. * prj-nmsc.adb (Ada_Check.Get_Path_Names_And_Record_Sources): Do not add directory separator if path already ends with a directory separator. 2004-08-13 Ed Schonberg <schonberg@gnat.com> * rtsfind.adb (Entity_Not_Defined): If the error ocurrs in a predefined unit, this is an attempt to inline a construct that is not available in the current restricted mode, so abort rather than trying to continue. * sem_ch3.adb (Build_Underlying_Full_View): If the new type has discriminants that rename those of the parent, recover names of original discriminants for the constraint on the full view of the parent. (Complete_Private_Subtype): Do not create a subtype declaration if the subtype is an itype. * gnat_rm.texi: Added section on implementation of discriminated records with default values for discriminants. 2004-08-13 Ed Schonberg <schonberg@gnat.com> PR ada/15601 * sem_res.adb (Make_Call_Into_Operator): Handle properly the case where the second operand is overloaded. From-SVN: r85934
Diffstat (limited to 'gcc/ada/decl.c')
-rw-r--r--gcc/ada/decl.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index 702e348..a3a7000 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -922,11 +922,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
used_by_ref = true;
const_flag = true;
- /* Get the data part of GNU_EXPR in case this was a
- aliased object whose nominal subtype is unconstrained.
- In that case the pointer above will be a thin pointer and
- build_allocator will automatically make the template and
- constructor already made above. */
+ /* In case this was a aliased object whose nominal subtype is
+ unconstrained, the pointer above will be a thin pointer and
+ build_allocator will automatically make the template.
+
+ If we have a template initializer only (that we made above),
+ pretend there is none and rely on what build_allocator creates
+ again anyway. Otherwise (if we have a full initializer), get
+ the data part and feed that to build_allocator. */
if (definition)
{
@@ -937,11 +940,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
{
gnu_alloc_type
= TREE_TYPE (TREE_CHAIN (TYPE_FIELDS (gnu_alloc_type)));
- gnu_expr
- = build_component_ref
- (gnu_expr, NULL_TREE,
- TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (gnu_expr))),
- false);
+
+ if (TREE_CODE (gnu_expr) == CONSTRUCTOR
+ &&
+ TREE_CHAIN (CONSTRUCTOR_ELTS (gnu_expr)) == NULL_TREE)
+ gnu_expr = 0;
+ else
+ gnu_expr
+ = build_component_ref
+ (gnu_expr, NULL_TREE,
+ TREE_CHAIN (TYPE_FIELDS (TREE_TYPE (gnu_expr))),
+ false);
}
if (TREE_CODE (TYPE_SIZE_UNIT (gnu_alloc_type)) == INTEGER_CST