Commit 7c775aca by Eric Botcazou Committed by Eric Botcazou

ada-tree.h (TYPE_IMPLEMENTS_PACKED_ARRAY_P): Rename to

	* gcc-interface/ada-tree.h (TYPE_IMPLEMENTS_PACKED_ARRAY_P): Rename to
	(TYPE_IMPL_PACKED_ARRAY_P): ...this.
	(TYPE_CAN_HAVE_DEBUG_TYPE_P): Do not test TYPE_DEBUG_TYPE.
	* gcc-interface/decl.c (gnat_to_gnu_entity): Simplify NULL_TREE tests
	and tweak gnat_encodings tests throughout.
	(initial_value_needs_conversion): Likewise.
	(intrin_arglists_compatible_p): Likewise.
	* gcc-interface/misc.c (gnat_print_type): Likewise.
	(gnat_get_debug_type): Likewise.
	(gnat_get_fixed_point_type_info): Likewise.
	(gnat_get_array_descr_info): Likewise.
	(get_array_bit_stride): Likewise.
	(gnat_get_type_bias): Fix formatting.
	(enumerate_modes): Likewise.
	* gcc-interface/trans.c (gnat_to_gnu): Likewise.
	(add_decl_expr): Simplify NULL_TREE test.
	(end_stmt_group): Likewise.
	(build_binary_op_trapv): Fix formatting.
	(get_exception_label): Use switch statement.
	(init_code_table): Move around.
	* gcc-interface/utils.c (global_bindings_p): Simplify NULL_TREE test.
	(gnat_poplevel): Likewise.
	(gnat_set_type_context): Likewise.
	(defer_or_set_type_context): Fix formatting.
	(gnat_pushdecl): Simplify NULL_TREE test.
	(maybe_pad_type): Likewise.
	(add_parallel_type): Likewise.
	(create_range_type): Likewise.
	(process_deferred_decl_context): Likewise.
	(convert): Likewise.
	(def_builtin_1): Likewise.
	* gcc-interface/utils2.c (find_common_type): Likewise.
	(build_binary_op): Likewise.
	(gnat_rewrite_reference): Likewise.
	(get_inner_constant_reference): Likewise.

From-SVN: r232501
parent 3dd5f42e
2016-01-18 Eric Botcazou <ebotcazou@adacore.com> 2016-01-18 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/ada-tree.h (TYPE_IMPLEMENTS_PACKED_ARRAY_P): Rename to
(TYPE_IMPL_PACKED_ARRAY_P): ...this.
(TYPE_CAN_HAVE_DEBUG_TYPE_P): Do not test TYPE_DEBUG_TYPE.
* gcc-interface/decl.c (gnat_to_gnu_entity): Simplify NULL_TREE tests
and tweak gnat_encodings tests throughout.
(initial_value_needs_conversion): Likewise.
(intrin_arglists_compatible_p): Likewise.
* gcc-interface/misc.c (gnat_print_type): Likewise.
(gnat_get_debug_type): Likewise.
(gnat_get_fixed_point_type_info): Likewise.
(gnat_get_array_descr_info): Likewise.
(get_array_bit_stride): Likewise.
(gnat_get_type_bias): Fix formatting.
(enumerate_modes): Likewise.
* gcc-interface/trans.c (gnat_to_gnu): Likewise.
(add_decl_expr): Simplify NULL_TREE test.
(end_stmt_group): Likewise.
(build_binary_op_trapv): Fix formatting.
(get_exception_label): Use switch statement.
(init_code_table): Move around.
* gcc-interface/utils.c (global_bindings_p): Simplify NULL_TREE test.
(gnat_poplevel): Likewise.
(gnat_set_type_context): Likewise.
(defer_or_set_type_context): Fix formatting.
(gnat_pushdecl): Simplify NULL_TREE test.
(maybe_pad_type): Likewise.
(add_parallel_type): Likewise.
(create_range_type): Likewise.
(process_deferred_decl_context): Likewise.
(convert): Likewise.
(def_builtin_1): Likewise.
* gcc-interface/utils2.c (find_common_type): Likewise.
(build_binary_op): Likewise.
(gnat_rewrite_reference): Likewise.
(get_inner_constant_reference): Likewise.
2016-01-18 Eric Botcazou <ebotcazou@adacore.com>
PR ada/69219 PR ada/69219
* gcc-interface/trans.c (check_inlining_for_nested_subprog): Consider * gcc-interface/trans.c (check_inlining_for_nested_subprog): Consider
the parent function instead of the current function in order to issue the parent function instead of the current function in order to issue
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Header File * * C Header File *
* * * *
* Copyright (C) 1992-2015, Free Software Foundation, Inc. * * Copyright (C) 1992-2016, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * 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- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -189,14 +189,12 @@ do { \ ...@@ -189,14 +189,12 @@ do { \
/* True for types that implement a packed array and for original packed array /* True for types that implement a packed array and for original packed array
types. */ types. */
#define TYPE_IMPLEMENTS_PACKED_ARRAY_P(NODE) \ #define TYPE_IMPL_PACKED_ARRAY_P(NODE) \
((TREE_CODE (NODE) == ARRAY_TYPE && TYPE_PACKED (NODE)) \ ((TREE_CODE (NODE) == ARRAY_TYPE && TYPE_PACKED (NODE)) \
|| (TREE_CODE (NODE) == INTEGER_TYPE && TYPE_PACKED_ARRAY_TYPE_P (NODE))) \ || (TREE_CODE (NODE) == INTEGER_TYPE && TYPE_PACKED_ARRAY_TYPE_P (NODE)))
/* True for types that can hold a debug type. */ /* True for types that can hold a debug type. */
#define TYPE_CAN_HAVE_DEBUG_TYPE_P(NODE) \ #define TYPE_CAN_HAVE_DEBUG_TYPE_P(NODE) (!TYPE_IMPL_PACKED_ARRAY_P (NODE))
(!TYPE_IMPLEMENTS_PACKED_ARRAY_P (NODE) \
&& TYPE_DEBUG_TYPE (NODE) != NULL_TREE)
/* For an UNCONSTRAINED_ARRAY_TYPE, this is the record containing both the /* For an UNCONSTRAINED_ARRAY_TYPE, this is the record containing both the
template and the object. template and the object.
...@@ -385,8 +383,8 @@ do { \ ...@@ -385,8 +383,8 @@ do { \
#define SET_TYPE_DEBUG_TYPE(NODE, X) \ #define SET_TYPE_DEBUG_TYPE(NODE, X) \
SET_TYPE_LANG_SPECIFIC2 (NODE, X) SET_TYPE_LANG_SPECIFIC2 (NODE, X)
/* For types with TYPE_IMPLEMENTS_PACKED_ARRAY_P, this is the original packed /* For types with TYPE_IMPL_PACKED_ARRAY_P, this is the original packed
array type. Note that this predicate is trou for original packed array array type. Note that this predicate is true for original packed array
types, so these cannot have a debug type. */ types, so these cannot have a debug type. */
#define TYPE_ORIGINAL_PACKED_ARRAY(NODE) \ #define TYPE_ORIGINAL_PACKED_ARRAY(NODE) \
GET_TYPE_LANG_SPECIFIC2 (NODE) GET_TYPE_LANG_SPECIFIC2 (NODE)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 1992-2015, Free Software Foundation, Inc. * * Copyright (C) 1992-2016, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * 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- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -1002,7 +1002,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1002,7 +1002,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* We cannot evaluate the first arm of a COMPOUND_EXPR in the /* We cannot evaluate the first arm of a COMPOUND_EXPR in the
correct place for this case, hence the above test. */ correct place for this case, hence the above test. */
gcc_assert (init == NULL_TREE); gcc_assert (!init);
/* No DECL_EXPR will be created so the expression needs to be /* No DECL_EXPR will be created so the expression needs to be
marked manually because it will likely be shared. */ marked manually because it will likely be shared. */
...@@ -2551,14 +2551,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -2551,14 +2551,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
types, are biased or are wider than sizetype. These are GNAT types, are biased or are wider than sizetype. These are GNAT
encodings, so we have to include them only when all encodings encodings, so we have to include them only when all encodings
are requested. */ are requested. */
if (gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL if ((TREE_CODE (gnu_orig_min) != INTEGER_CST
&& (TREE_CODE (gnu_orig_min) != INTEGER_CST || TREE_CODE (gnu_orig_max) != INTEGER_CST
|| TREE_CODE (gnu_orig_max) != INTEGER_CST || TREE_CODE (gnu_index_type) != INTEGER_TYPE
|| TREE_CODE (gnu_index_type) != INTEGER_TYPE || (TREE_TYPE (gnu_index_type)
|| (TREE_TYPE (gnu_index_type) && TREE_CODE (TREE_TYPE (gnu_index_type))
&& TREE_CODE (TREE_TYPE (gnu_index_type)) != INTEGER_TYPE)
!= INTEGER_TYPE) || TYPE_BIASED_REPRESENTATION_P (gnu_index_type))
|| TYPE_BIASED_REPRESENTATION_P (gnu_index_type))) && gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
need_index_type_struct = true; need_index_type_struct = true;
} }
...@@ -2621,8 +2621,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -2621,8 +2621,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
} }
/* Strip the ___XP suffix for standard DWARF. */ /* Strip the ___XP suffix for standard DWARF. */
if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL if (Is_Packed_Array_Impl_Type (gnat_entity)
&& Is_Packed_Array_Impl_Type (gnat_entity)) && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
{ {
Entity_Id gnat_original_array_type Entity_Id gnat_original_array_type
= Underlying_Type (Original_Array_Type (gnat_entity)); = Underlying_Type (Original_Array_Type (gnat_entity));
...@@ -2717,8 +2717,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -2717,8 +2717,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
{ {
tree gnu_base_decl tree gnu_base_decl
= gnat_to_gnu_entity (Etype (gnat_entity), NULL_TREE, 0); = gnat_to_gnu_entity (Etype (gnat_entity), NULL_TREE, 0);
if (gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL if (!DECL_ARTIFICIAL (gnu_base_decl)
&& !DECL_ARTIFICIAL (gnu_base_decl)) && gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
add_parallel_type (gnu_type, add_parallel_type (gnu_type,
TREE_TYPE (TREE_TYPE (gnu_base_decl))); TREE_TYPE (TREE_TYPE (gnu_base_decl)));
} }
...@@ -4279,7 +4279,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -4279,7 +4279,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& Present (gnat_renamed) && Present (gnat_renamed)
&& (Ekind (gnat_renamed) == E_Function && (Ekind (gnat_renamed) == E_Function
|| Ekind (gnat_renamed) == E_Procedure) || Ekind (gnat_renamed) == E_Procedure)
&& gnu_decl != NULL_TREE && gnu_decl
&& TREE_CODE (gnu_decl) == FUNCTION_DECL) && TREE_CODE (gnu_decl) == FUNCTION_DECL)
{ {
tree decl = build_decl (input_location, IMPORTED_DECL, tree decl = build_decl (input_location, IMPORTED_DECL,
...@@ -4306,7 +4306,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -4306,7 +4306,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
to let developers be notified on demand without risking false to let developers be notified on demand without risking false
positives with common default sets of options. */ positives with common default sets of options. */
if (gnu_builtin_decl == NULL_TREE && warn_shadow) if (!gnu_builtin_decl && warn_shadow)
post_error ("?gcc intrinsic not found for&!", gnat_entity); post_error ("?gcc intrinsic not found for&!", gnat_entity);
} }
...@@ -6171,8 +6171,8 @@ initial_value_needs_conversion (tree gnu_type, tree gnu_expr) ...@@ -6171,8 +6171,8 @@ initial_value_needs_conversion (tree gnu_type, tree gnu_expr)
without one, to keep the object simpler. */ without one, to keep the object simpler. */
if (TREE_CODE (gnu_type) == RECORD_TYPE if (TREE_CODE (gnu_type) == RECORD_TYPE
&& TREE_CODE (TREE_TYPE (gnu_expr)) == RECORD_TYPE && TREE_CODE (TREE_TYPE (gnu_expr)) == RECORD_TYPE
&& get_variant_part (gnu_type) != NULL_TREE && get_variant_part (gnu_type)
&& get_variant_part (TREE_TYPE (gnu_expr)) == NULL_TREE) && !get_variant_part (TREE_TYPE (gnu_expr)))
return false; return false;
/* In all the other cases, convert the expression to the object's type. */ /* In all the other cases, convert the expression to the object's type. */
...@@ -8527,17 +8527,17 @@ intrin_arglists_compatible_p (intrin_binding_t * inb) ...@@ -8527,17 +8527,17 @@ intrin_arglists_compatible_p (intrin_binding_t * inb)
/* Sequence position of the last argument we checked. */ /* Sequence position of the last argument we checked. */
int argpos = 0; int argpos = 0;
while (1) while (true)
{ {
tree ada_type = function_args_iter_cond (&ada_iter); tree ada_type = function_args_iter_cond (&ada_iter);
tree btin_type = function_args_iter_cond (&btin_iter); tree btin_type = function_args_iter_cond (&btin_iter);
/* If we've exhausted both lists simultaneously, we're done. */ /* If we've exhausted both lists simultaneously, we're done. */
if (ada_type == NULL_TREE && btin_type == NULL_TREE) if (!ada_type && !btin_type)
break; break;
/* If one list is shorter than the other, they fail to match. */ /* If one list is shorter than the other, they fail to match. */
if (ada_type == NULL_TREE || btin_type == NULL_TREE) if (!ada_type || !btin_type)
return false; return false;
/* If we're done with the Ada args and not with the internal builtin /* If we're done with the Ada args and not with the internal builtin
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 1992-2015, Free Software Foundation, Inc. * * Copyright (C) 1992-2016, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * 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- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -112,8 +112,8 @@ gnat_parse_file (void) ...@@ -112,8 +112,8 @@ gnat_parse_file (void)
/* ??? Call the SEH initialization routine. This is to workaround /* ??? Call the SEH initialization routine. This is to workaround
a bootstrap path problem. The call below should be removed at some a bootstrap path problem. The call below should be removed at some
point and the SEH pointer passed to __gnat_initialize() above. */ point and the SEH pointer passed to __gnat_initialize above. */
__gnat_install_SEH_handler((void *)seh); __gnat_install_SEH_handler ((void *)seh);
/* Call the front-end elaboration procedures. */ /* Call the front-end elaboration procedures. */
adainit (); adainit ();
...@@ -528,10 +528,10 @@ gnat_print_type (FILE *file, tree node, int indent) ...@@ -528,10 +528,10 @@ gnat_print_type (FILE *file, tree node, int indent)
break; break;
} }
if (TYPE_CAN_HAVE_DEBUG_TYPE_P (node) && TYPE_DEBUG_TYPE (node) != NULL_TREE) if (TYPE_CAN_HAVE_DEBUG_TYPE_P (node) && TYPE_DEBUG_TYPE (node))
print_node_brief (file, "debug type", TYPE_DEBUG_TYPE (node), indent + 4); print_node_brief (file, "debug type", TYPE_DEBUG_TYPE (node), indent + 4);
else if (TYPE_IMPLEMENTS_PACKED_ARRAY_P (node)
&& TYPE_ORIGINAL_PACKED_ARRAY (node) != NULL_TREE) if (TYPE_IMPL_PACKED_ARRAY_P (node) && TYPE_ORIGINAL_PACKED_ARRAY (node))
print_node_brief (file, "original packed array", print_node_brief (file, "original packed array",
TYPE_ORIGINAL_PACKED_ARRAY (node), indent + 4); TYPE_ORIGINAL_PACKED_ARRAY (node), indent + 4);
} }
...@@ -575,23 +575,25 @@ gnat_descriptive_type (const_tree type) ...@@ -575,23 +575,25 @@ gnat_descriptive_type (const_tree type)
return NULL_TREE; return NULL_TREE;
} }
/* Return the type to used for debugging information instead of TYPE, if any. /* Return the type to be used for debugging information instead of TYPE or
NULL_TREE if TYPE is fine. */ NULL_TREE if TYPE is fine. */
static tree static tree
gnat_get_debug_type (const_tree type) gnat_get_debug_type (const_tree type)
{ {
if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type)) if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type) && TYPE_DEBUG_TYPE (type))
{ {
type = TYPE_DEBUG_TYPE (type); type = TYPE_DEBUG_TYPE (type);
/* ??? Kludge: the get_debug_type language hook is processed after the
array descriptor language hook, so if there is an array behind this /* ??? The get_debug_type language hook is processed after the array
type, the latter is supposed to handle it. Still, we can get here descriptor language hook, so if there is an array behind this type,
with a type we are not supposed to handle (when the DWARF back-end the latter is supposed to handle it. Still, we can get here with
a type we are not supposed to handle (e.g. when the DWARF back-end
processes the type of a variable), so keep this guard. */ processes the type of a variable), so keep this guard. */
if (type != NULL_TREE && !TYPE_IMPLEMENTS_PACKED_ARRAY_P (type)) if (type && TYPE_CAN_HAVE_DEBUG_TYPE_P (type))
return const_cast<tree> (type); return const_cast<tree> (type);
} }
return NULL_TREE; return NULL_TREE;
} }
...@@ -606,8 +608,8 @@ gnat_get_fixed_point_type_info (const_tree type, ...@@ -606,8 +608,8 @@ gnat_get_fixed_point_type_info (const_tree type,
/* GDB cannot handle fixed-point types yet, so rely on GNAT encodings /* GDB cannot handle fixed-point types yet, so rely on GNAT encodings
instead for it. */ instead for it. */
if (gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL if (!TYPE_IS_FIXED_POINT_P (type)
|| !TYPE_IS_FIXED_POINT_P (type)) || gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
return false; return false;
scale_factor = TYPE_SCALE_FACTOR (type); scale_factor = TYPE_SCALE_FACTOR (type);
...@@ -640,6 +642,7 @@ gnat_get_fixed_point_type_info (const_tree type, ...@@ -640,6 +642,7 @@ gnat_get_fixed_point_type_info (const_tree type,
gcc_assert (num == integer_one_node gcc_assert (num == integer_one_node
&& TREE_CODE (base) == INTEGER_CST && TREE_CODE (base) == INTEGER_CST
&& TREE_CODE (exponent) == INTEGER_CST); && TREE_CODE (exponent) == INTEGER_CST);
switch (tree_to_shwi (base)) switch (tree_to_shwi (base))
{ {
case 2: case 2:
...@@ -661,6 +664,7 @@ gnat_get_fixed_point_type_info (const_tree type, ...@@ -661,6 +664,7 @@ gnat_get_fixed_point_type_info (const_tree type,
expect N / D with constant operands. */ expect N / D with constant operands. */
gcc_assert (TREE_CODE (num) == INTEGER_CST gcc_assert (TREE_CODE (num) == INTEGER_CST
&& TREE_CODE (den) == INTEGER_CST); && TREE_CODE (den) == INTEGER_CST);
info->scale_factor_kind = fixed_point_scale_factor_arbitrary; info->scale_factor_kind = fixed_point_scale_factor_arbitrary;
info->scale_factor.arbitrary.numerator = tree_to_uhwi (num); info->scale_factor.arbitrary.numerator = tree_to_uhwi (num);
info->scale_factor.arbitrary.denominator = tree_to_shwi (den); info->scale_factor.arbitrary.denominator = tree_to_shwi (den);
...@@ -746,7 +750,7 @@ gnat_type_max_size (const_tree gnu_type) ...@@ -746,7 +750,7 @@ gnat_type_max_size (const_tree gnu_type)
return max_unitsize; return max_unitsize;
} }
static tree get_array_bit_stride (tree comp_type); static tree get_array_bit_stride (tree);
/* Provide information in INFO for debug output about the TYPE array type. /* Provide information in INFO for debug output about the TYPE array type.
Return whether TYPE is handled. */ Return whether TYPE is handled. */
...@@ -759,9 +763,7 @@ gnat_get_array_descr_info (const_tree const_type, ...@@ -759,9 +763,7 @@ gnat_get_array_descr_info (const_tree const_type,
bool is_array = false; bool is_array = false;
bool is_fat_ptr = false; bool is_fat_ptr = false;
bool is_packed_array = false; bool is_packed_array = false;
tree type = const_cast<tree> (const_type); tree type = const_cast<tree> (const_type);
const_tree first_dimen = NULL_TREE; const_tree first_dimen = NULL_TREE;
const_tree last_dimen = NULL_TREE; const_tree last_dimen = NULL_TREE;
const_tree dimen; const_tree dimen;
...@@ -774,18 +776,16 @@ gnat_get_array_descr_info (const_tree const_type, ...@@ -774,18 +776,16 @@ gnat_get_array_descr_info (const_tree const_type,
tree thinptr_template_expr = NULL_TREE; tree thinptr_template_expr = NULL_TREE;
tree thinptr_bound_field = NULL_TREE; tree thinptr_bound_field = NULL_TREE;
/* ??? Kludge: see gnat_get_debug_type. */ /* ??? See gnat_get_debug_type. */
if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type) if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type) && TYPE_DEBUG_TYPE (type))
&& TYPE_DEBUG_TYPE (type) != NULL_TREE)
type = TYPE_DEBUG_TYPE (type); type = TYPE_DEBUG_TYPE (type);
/* If we have an implementation type for a packed array, get the orignial /* If we have an implementation type for a packed array, get the orignial
array type. */ array type. */
if (TYPE_IMPLEMENTS_PACKED_ARRAY_P (type) if (TYPE_IMPL_PACKED_ARRAY_P (type) && TYPE_ORIGINAL_PACKED_ARRAY (type))
&& TYPE_ORIGINAL_PACKED_ARRAY (type) != NULL_TREE)
{ {
is_packed_array = true;
type = TYPE_ORIGINAL_PACKED_ARRAY (type); type = TYPE_ORIGINAL_PACKED_ARRAY (type);
is_packed_array = true;
} }
/* First pass: gather all information about this array except everything /* First pass: gather all information about this array except everything
...@@ -801,8 +801,8 @@ gnat_get_array_descr_info (const_tree const_type, ...@@ -801,8 +801,8 @@ gnat_get_array_descr_info (const_tree const_type,
info->data_location = NULL_TREE; info->data_location = NULL_TREE;
} }
else if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL else if (TYPE_IS_FAT_POINTER_P (type)
&& TYPE_IS_FAT_POINTER_P (type)) && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
{ {
const tree ua_type = TYPE_UNCONSTRAINED_ARRAY (type); const tree ua_type = TYPE_UNCONSTRAINED_ARRAY (type);
...@@ -828,9 +828,9 @@ gnat_get_array_descr_info (const_tree const_type, ...@@ -828,9 +828,9 @@ gnat_get_array_descr_info (const_tree const_type,
them to appear in the debug info as pointers to an array type. That's why them to appear in the debug info as pointers to an array type. That's why
we match only the RECORD_TYPE here instead of the POINTER_TYPE with the we match only the RECORD_TYPE here instead of the POINTER_TYPE with the
TYPE_IS_THIN_POINTER_P predicate. */ TYPE_IS_THIN_POINTER_P predicate. */
else if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL else if (TREE_CODE (type) == RECORD_TYPE
&& TREE_CODE (type) == RECORD_TYPE && TYPE_CONTAINS_TEMPLATE_P (type)
&& TYPE_CONTAINS_TEMPLATE_P (type)) && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
{ {
/* This will be our base object address. Note that we assume that /* This will be our base object address. Note that we assume that
pointers to these will actually point to the array field (thin pointers to these will actually point to the array field (thin
...@@ -910,9 +910,7 @@ gnat_get_array_descr_info (const_tree const_type, ...@@ -910,9 +910,7 @@ gnat_get_array_descr_info (const_tree const_type,
structure. */ structure. */
for (i = (convention_fortran_p ? info->ndimensions - 1 : 0), for (i = (convention_fortran_p ? info->ndimensions - 1 : 0),
dimen = first_dimen; dimen = first_dimen;
0 <= i && i < info->ndimensions; 0 <= i && i < info->ndimensions;
i += (convention_fortran_p ? -1 : 1), i += (convention_fortran_p ? -1 : 1),
dimen = TREE_TYPE (dimen)) dimen = TREE_TYPE (dimen))
{ {
...@@ -927,12 +925,10 @@ gnat_get_array_descr_info (const_tree const_type, ...@@ -927,12 +925,10 @@ gnat_get_array_descr_info (const_tree const_type,
there are two cases where we generate self-referencial bound there are two cases where we generate self-referencial bound
expressions: arrays that are constrained by record discriminants expressions: arrays that are constrained by record discriminants
and XUA types. */ and XUA types. */
const bool is_xua_type = if (TYPE_CONTEXT (first_dimen)
(TYPE_CONTEXT (first_dimen) != NULL_TREE && TREE_CODE (TYPE_CONTEXT (first_dimen)) != RECORD_TYPE
&& TREE_CODE (TYPE_CONTEXT (first_dimen)) != RECORD_TYPE && contains_placeholder_p (TYPE_MIN_VALUE (index_type))
&& contains_placeholder_p (TYPE_MIN_VALUE (index_type))); && gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
if (is_xua_type && gnat_encodings != DWARF_GNAT_ENCODINGS_MINIMAL)
{ {
info->dimen[i].lower_bound = NULL_TREE; info->dimen[i].lower_bound = NULL_TREE;
info->dimen[i].upper_bound = NULL_TREE; info->dimen[i].upper_bound = NULL_TREE;
...@@ -960,9 +956,10 @@ gnat_get_array_descr_info (const_tree const_type, ...@@ -960,9 +956,10 @@ gnat_get_array_descr_info (const_tree const_type,
/* The DWARF back-end will output exactly INDEX_TYPE as the array index' /* The DWARF back-end will output exactly INDEX_TYPE as the array index'
"root" type, so pell subtypes when possible. */ "root" type, so pell subtypes when possible. */
while (TREE_TYPE (index_type) != NULL_TREE while (TREE_TYPE (index_type)
&& !subrange_type_for_debug_p (index_type, NULL, NULL)) && !subrange_type_for_debug_p (index_type, NULL, NULL))
index_type = TREE_TYPE (index_type); index_type = TREE_TYPE (index_type);
info->dimen[i].bounds_type = index_type; info->dimen[i].bounds_type = index_type;
info->dimen[i].stride = NULL_TREE; info->dimen[i].stride = NULL_TREE;
} }
...@@ -980,9 +977,9 @@ gnat_get_array_descr_info (const_tree const_type, ...@@ -980,9 +977,9 @@ gnat_get_array_descr_info (const_tree const_type,
element. This is why we emit a stride in such situations. */ element. This is why we emit a stride in such situations. */
tree source_element_type = info->element_type; tree source_element_type = info->element_type;
while (1) while (true)
{ {
if (TYPE_DEBUG_TYPE (source_element_type) != NULL_TREE) if (TYPE_DEBUG_TYPE (source_element_type))
source_element_type = TYPE_DEBUG_TYPE (source_element_type); source_element_type = TYPE_DEBUG_TYPE (source_element_type);
else if (TYPE_IS_PADDING_P (source_element_type)) else if (TYPE_IS_PADDING_P (source_element_type))
source_element_type source_element_type
...@@ -1024,11 +1021,9 @@ get_array_bit_stride (tree comp_type) ...@@ -1024,11 +1021,9 @@ get_array_bit_stride (tree comp_type)
if (INTEGRAL_TYPE_P (comp_type)) if (INTEGRAL_TYPE_P (comp_type))
return TYPE_RM_SIZE (comp_type); return TYPE_RM_SIZE (comp_type);
/* Otherwise, see if this is an array we can analyze. */ /* Otherwise, see if this is an array we can analyze; if it's not, punt. */
memset (&info, 0, sizeof (info)); memset (&info, 0, sizeof (info));
if (!gnat_get_array_descr_info (comp_type, &info) if (!gnat_get_array_descr_info (comp_type, &info) || !info.stride)
|| info.stride == NULL_TREE)
/* If it's not, give it up. */
return NULL_TREE; return NULL_TREE;
/* Otherwise, the array stride is the inner array's stride multiplied by the /* Otherwise, the array stride is the inner array's stride multiplied by the
...@@ -1047,8 +1042,7 @@ get_array_bit_stride (tree comp_type) ...@@ -1047,8 +1042,7 @@ get_array_bit_stride (tree comp_type)
{ {
tree count; tree count;
if (info.dimen[i].lower_bound == NULL_TREE if (!info.dimen[i].lower_bound || !info.dimen[i].upper_bound)
|| info.dimen[i].upper_bound == NULL_TREE)
return NULL_TREE; return NULL_TREE;
/* Put in count an expression that computes the length of this /* Put in count an expression that computes the length of this
...@@ -1080,13 +1074,16 @@ gnat_get_subrange_bounds (const_tree gnu_type, tree *lowval, tree *highval) ...@@ -1080,13 +1074,16 @@ gnat_get_subrange_bounds (const_tree gnu_type, tree *lowval, tree *highval)
*highval = TYPE_MAX_VALUE (gnu_type); *highval = TYPE_MAX_VALUE (gnu_type);
} }
/* Return the bias of GNU_TYPE, if any. */
static tree static tree
gnat_get_type_bias (const_tree gnu_type) gnat_get_type_bias (const_tree gnu_type)
{ {
if (TREE_CODE (gnu_type) == INTEGER_TYPE if (TREE_CODE (gnu_type) == INTEGER_TYPE
&& TYPE_BIASED_REPRESENTATION_P (gnu_type) && TYPE_BIASED_REPRESENTATION_P (gnu_type)
&& gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
return TYPE_RM_MIN_VALUE(gnu_type); return TYPE_RM_MIN_VALUE (gnu_type);
return NULL_TREE; return NULL_TREE;
} }
...@@ -1240,7 +1237,7 @@ enumerate_modes (void (*f) (const char *, int, int, int, int, int, int, int)) ...@@ -1240,7 +1237,7 @@ enumerate_modes (void (*f) (const char *, int, int, int, int, int, int, int))
digs = fmt->p; digs = fmt->p;
else else
gcc_unreachable(); gcc_unreachable ();
} }
/* First register any C types for this mode that the front end /* First register any C types for this mode that the front end
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 1992-2015, Free Software Foundation, Inc. * * Copyright (C) 1992-2016, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * 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- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -6027,7 +6027,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -6027,7 +6027,7 @@ gnat_to_gnu (Node_Id gnat_node)
full view since the clause is on the partial view and we cannot have full view since the clause is on the partial view and we cannot have
2 different GCC trees for the object. The only bits of the full view 2 different GCC trees for the object. The only bits of the full view
we will use is the initializer, but it will be directly fetched. */ we will use is the initializer, but it will be directly fetched. */
if (Ekind(gnat_temp) == E_Constant if (Ekind (gnat_temp) == E_Constant
&& Present (Address_Clause (gnat_temp)) && Present (Address_Clause (gnat_temp))
&& Present (Full_View (gnat_temp))) && Present (Full_View (gnat_temp)))
save_gnu_tree (Full_View (gnat_temp), error_mark_node, true); save_gnu_tree (Full_View (gnat_temp), error_mark_node, true);
...@@ -8035,7 +8035,7 @@ add_decl_expr (tree gnu_decl, Entity_Id gnat_entity) ...@@ -8035,7 +8035,7 @@ add_decl_expr (tree gnu_decl, Entity_Id gnat_entity)
/* If this is a variable and an initializer is attached to it, it must be /* If this is a variable and an initializer is attached to it, it must be
valid for the context. Similar to init_const in create_var_decl. */ valid for the context. Similar to init_const in create_var_decl. */
if (TREE_CODE (gnu_decl) == VAR_DECL if (TREE_CODE (gnu_decl) == VAR_DECL
&& (gnu_init = DECL_INITIAL (gnu_decl)) != NULL_TREE && (gnu_init = DECL_INITIAL (gnu_decl))
&& (!gnat_types_compatible_p (type, TREE_TYPE (gnu_init)) && (!gnat_types_compatible_p (type, TREE_TYPE (gnu_init))
|| (TREE_STATIC (gnu_decl) || (TREE_STATIC (gnu_decl)
&& !initializer_constant_valid_p (gnu_init, && !initializer_constant_valid_p (gnu_init,
...@@ -8128,7 +8128,7 @@ end_stmt_group (void) ...@@ -8128,7 +8128,7 @@ end_stmt_group (void)
are cleanups, make a TRY_FINALLY_EXPR. Last, if there is a BLOCK, are cleanups, make a TRY_FINALLY_EXPR. Last, if there is a BLOCK,
make a BIND_EXPR. Note that we nest in that because the cleanup may make a BIND_EXPR. Note that we nest in that because the cleanup may
reference variables in the block. */ reference variables in the block. */
if (gnu_retval == NULL_TREE) if (!gnu_retval)
gnu_retval = alloc_stmt_list (); gnu_retval = alloc_stmt_list ();
if (group->cleanups) if (group->cleanups)
...@@ -9023,7 +9023,7 @@ build_binary_op_trapv (enum tree_code code, tree gnu_type, tree left, ...@@ -9023,7 +9023,7 @@ build_binary_op_trapv (enum tree_code code, tree gnu_type, tree left,
break; break;
default: default:
gcc_unreachable(); gcc_unreachable ();
} }
check = fold_build3 (COND_EXPR, boolean_type_node, rhs_lt_zero, check_neg, check = fold_build3 (COND_EXPR, boolean_type_node, rhs_lt_zero, check_neg,
...@@ -10083,7 +10083,39 @@ post_error_ne_tree_2 (const char *msg, Node_Id node, Entity_Id ent, tree t, ...@@ -10083,7 +10083,39 @@ post_error_ne_tree_2 (const char *msg, Node_Id node, Entity_Id ent, tree t,
Error_Msg_Uint_2 = UI_From_Int (num); Error_Msg_Uint_2 = UI_From_Int (num);
post_error_ne_tree (msg, node, ent, t); post_error_ne_tree (msg, node, ent, t);
} }
/* Return a label to branch to for the exception type in KIND or NULL_TREE
if none. */
tree
get_exception_label (char kind)
{
switch (kind)
{
case N_Raise_Constraint_Error:
return gnu_constraint_error_label_stack->last ();
case N_Raise_Storage_Error:
return gnu_storage_error_label_stack->last ();
case N_Raise_Program_Error:
return gnu_program_error_label_stack->last ();
default:
break;
}
return NULL_TREE;
}
/* Return the decl for the current elaboration procedure. */
tree
get_elaboration_procedure (void)
{
return gnu_elab_proc_stack->last ();
}
/* Initialize the table that maps GNAT codes to GCC codes for simple /* Initialize the table that maps GNAT codes to GCC codes for simple
binary and unary operations. */ binary and unary operations. */
...@@ -10117,28 +10149,4 @@ init_code_table (void) ...@@ -10117,28 +10149,4 @@ init_code_table (void)
gnu_codes[N_Op_Shift_Right_Arithmetic] = RSHIFT_EXPR; gnu_codes[N_Op_Shift_Right_Arithmetic] = RSHIFT_EXPR;
} }
/* Return a label to branch to for the exception type in KIND or NULL_TREE
if none. */
tree
get_exception_label (char kind)
{
if (kind == N_Raise_Constraint_Error)
return gnu_constraint_error_label_stack->last ();
else if (kind == N_Raise_Storage_Error)
return gnu_storage_error_label_stack->last ();
else if (kind == N_Raise_Program_Error)
return gnu_program_error_label_stack->last ();
else
return NULL_TREE;
}
/* Return the decl for the current elaboration procedure. */
tree
get_elaboration_procedure (void)
{
return gnu_elab_proc_stack->last ();
}
#include "gt-ada-trans.h" #include "gt-ada-trans.h"
...@@ -429,7 +429,7 @@ build_dummy_unc_pointer_types (Entity_Id gnat_desig_type, tree gnu_desig_type) ...@@ -429,7 +429,7 @@ build_dummy_unc_pointer_types (Entity_Id gnat_desig_type, tree gnu_desig_type)
bool bool
global_bindings_p (void) global_bindings_p (void)
{ {
return force_global || current_function_decl == NULL_TREE; return force_global || !current_function_decl;
} }
/* Enter a new binding level. */ /* Enter a new binding level. */
...@@ -515,7 +515,7 @@ gnat_poplevel (void) ...@@ -515,7 +515,7 @@ gnat_poplevel (void)
parent block. Otherwise, add it to the list of its parent. */ parent block. Otherwise, add it to the list of its parent. */
if (TREE_CODE (BLOCK_SUPERCONTEXT (block)) == FUNCTION_DECL) if (TREE_CODE (BLOCK_SUPERCONTEXT (block)) == FUNCTION_DECL)
; ;
else if (BLOCK_VARS (block) == NULL_TREE) else if (!BLOCK_VARS (block))
{ {
BLOCK_SUBBLOCKS (level->chain->block) BLOCK_SUBBLOCKS (level->chain->block)
= block_chainon (BLOCK_SUBBLOCKS (block), = block_chainon (BLOCK_SUBBLOCKS (block),
...@@ -570,9 +570,9 @@ gnat_set_type_context (tree type, tree context) ...@@ -570,9 +570,9 @@ gnat_set_type_context (tree type, tree context)
/* Give a context to the parallel types and their stub decl, if any. /* Give a context to the parallel types and their stub decl, if any.
Some parallel types seems to be present in multiple parallel type Some parallel types seems to be present in multiple parallel type
chains, so don't mess with their context if they already have one. */ chains, so don't mess with their context if they already have one. */
if (TYPE_CONTEXT (parallel_type) == NULL_TREE) if (!TYPE_CONTEXT (parallel_type))
{ {
if (TYPE_STUB_DECL (parallel_type) != NULL_TREE) if (TYPE_STUB_DECL (parallel_type))
DECL_CONTEXT (TYPE_STUB_DECL (parallel_type)) = context; DECL_CONTEXT (TYPE_STUB_DECL (parallel_type)) = context;
TYPE_CONTEXT (parallel_type) = context; TYPE_CONTEXT (parallel_type) = context;
} }
...@@ -625,17 +625,18 @@ get_debug_scope (Node_Id gnat_node, bool *is_subprogram) ...@@ -625,17 +625,18 @@ get_debug_scope (Node_Id gnat_node, bool *is_subprogram)
the outer one. */ the outer one. */
break; break;
} }
gnat_entity = Scope (gnat_entity); gnat_entity = Scope (gnat_entity);
} }
return Empty; return Empty;
} }
/* If N is NULL, set TYPE's context to CONTEXT. Defer this to the processing of /* If N is NULL, set TYPE's context to CONTEXT. Defer this to the processing
N otherwise. */ of N otherwise. */
static void static void
defer_or_set_type_context (tree type, defer_or_set_type_context (tree type, tree context,
tree context,
struct deferred_decl_context_node *n) struct deferred_decl_context_node *n)
{ {
if (n) if (n)
...@@ -644,7 +645,7 @@ defer_or_set_type_context (tree type, ...@@ -644,7 +645,7 @@ defer_or_set_type_context (tree type,
gnat_set_type_context (type, context); gnat_set_type_context (type, context);
} }
/* Return global_context. Create it if needed, first. */ /* Return global_context, but create it first if need be. */
static tree static tree
get_global_context (void) get_global_context (void)
...@@ -654,6 +655,7 @@ get_global_context (void) ...@@ -654,6 +655,7 @@ get_global_context (void)
global_context = build_translation_unit_decl (NULL_TREE); global_context = build_translation_unit_decl (NULL_TREE);
debug_hooks->register_main_translation_unit (global_context); debug_hooks->register_main_translation_unit (global_context);
} }
return global_context; return global_context;
} }
...@@ -694,14 +696,14 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) ...@@ -694,14 +696,14 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
/* External declarations (when force_global > 0) may not be in a /* External declarations (when force_global > 0) may not be in a
local context. */ local context. */
else if (current_function_decl != NULL_TREE && force_global == 0) else if (current_function_decl && force_global == 0)
context = current_function_decl; context = current_function_decl;
} }
/* If either we are forced to be in global mode or if both the GNAT scope and /* If either we are forced to be in global mode or if both the GNAT scope and
the current_function_decl did not help determining the context, use the the current_function_decl did not help in determining the context, use the
global scope. */ global scope. */
if (!deferred_decl_context && context == NULL_TREE) if (!deferred_decl_context && !context)
context = get_global_context (); context = get_global_context ();
/* Functions imported in another function are not really nested. /* Functions imported in another function are not really nested.
...@@ -710,9 +712,9 @@ gnat_pushdecl (tree decl, Node_Id gnat_node) ...@@ -710,9 +712,9 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
lower_nested_functions will then recompute it. */ lower_nested_functions will then recompute it. */
if (TREE_CODE (decl) == FUNCTION_DECL if (TREE_CODE (decl) == FUNCTION_DECL
&& !TREE_PUBLIC (decl) && !TREE_PUBLIC (decl)
&& context != NULL_TREE && context
&& (TREE_CODE (context) == FUNCTION_DECL && (TREE_CODE (context) == FUNCTION_DECL
|| decl_function_context (context) != NULL_TREE)) || decl_function_context (context)))
DECL_STATIC_CHAIN (decl) = 1; DECL_STATIC_CHAIN (decl) = 1;
if (!deferred_decl_context) if (!deferred_decl_context)
...@@ -1281,16 +1283,15 @@ maybe_pad_type (tree type, tree size, unsigned int align, ...@@ -1281,16 +1283,15 @@ maybe_pad_type (tree type, tree size, unsigned int align,
if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL) if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
SET_TYPE_DEBUG_TYPE (record, type); SET_TYPE_DEBUG_TYPE (record, type);
/* ??? Kludge: padding types around packed array implementation types will be /* ??? Padding types around packed array implementation types will be
considered as root types in the array descriptor language hook (see considered as root types in the array descriptor language hook (see
gnat_get_array_descr_info). Give them the original packed array type gnat_get_array_descr_info). Give them the original packed array type
name so that the one coming from sources appears in the debugging name so that the one coming from sources appears in the debugging
information. */ information. */
if (gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL if (TYPE_IMPL_PACKED_ARRAY_P (type)
&& TYPE_IMPLEMENTS_PACKED_ARRAY_P (type) && TYPE_ORIGINAL_PACKED_ARRAY (type)
&& TYPE_ORIGINAL_PACKED_ARRAY (type) != NULL_TREE) && gnat_encodings == DWARF_GNAT_ENCODINGS_MINIMAL)
TYPE_NAME (record) TYPE_NAME (record) = TYPE_NAME (TYPE_ORIGINAL_PACKED_ARRAY (type));
= TYPE_NAME (TYPE_ORIGINAL_PACKED_ARRAY (type));
else if (Present (gnat_entity)) else if (Present (gnat_entity))
TYPE_NAME (record) = create_concat_name (gnat_entity, "PAD"); TYPE_NAME (record) = create_concat_name (gnat_entity, "PAD");
...@@ -1855,17 +1856,17 @@ add_parallel_type (tree type, tree parallel_type) ...@@ -1855,17 +1856,17 @@ add_parallel_type (tree type, tree parallel_type)
SET_DECL_PARALLEL_TYPE (decl, parallel_type); SET_DECL_PARALLEL_TYPE (decl, parallel_type);
/* If PARALLEL_TYPE already has a context, we are done. */ /* If PARALLEL_TYPE already has a context, we are done. */
if (TYPE_CONTEXT (parallel_type) != NULL_TREE) if (TYPE_CONTEXT (parallel_type))
return; return;
/* Otherwise, try to get one from TYPE's context. */ /* Otherwise, try to get one from TYPE's context. If so, simply propagate
if (TYPE_CONTEXT (type) != NULL_TREE) it to PARALLEL_TYPE. */
/* TYPE already has a context, so simply propagate it to PARALLEL_TYPE. */ if (TYPE_CONTEXT (type))
gnat_set_type_context (parallel_type, TYPE_CONTEXT (type)); gnat_set_type_context (parallel_type, TYPE_CONTEXT (type));
/* ... otherwise TYPE has not context yet. We know it will thanks to /* Otherwise TYPE has not context yet. We know it will have one thanks to
gnat_pushdecl, and then its context will be propagated to PARALLEL_TYPE. gnat_pushdecl and then its context will be propagated to PARALLEL_TYPE,
So we have nothing to do in this case. */ so we have nothing to do in this case. */
} }
/* Return true if TYPE has a parallel type. */ /* Return true if TYPE has a parallel type. */
...@@ -2269,7 +2270,7 @@ create_range_type (tree type, tree min, tree max) ...@@ -2269,7 +2270,7 @@ create_range_type (tree type, tree min, tree max)
{ {
tree range_type; tree range_type;
if (type == NULL_TREE) if (!type)
type = sizetype; type = sizetype;
/* First build a type with the base range. */ /* First build a type with the base range. */
...@@ -2905,32 +2906,30 @@ process_deferred_decl_context (bool force) ...@@ -2905,32 +2906,30 @@ process_deferred_decl_context (bool force)
while (Present (gnat_scope)) while (Present (gnat_scope))
{ {
context = compute_deferred_decl_context (gnat_scope); context = compute_deferred_decl_context (gnat_scope);
if (!force || context != NULL_TREE) if (!force || context)
break; break;
gnat_scope = get_debug_scope (gnat_scope, NULL); gnat_scope = get_debug_scope (gnat_scope, NULL);
} }
/* Imported declarations must not be in a local context (i.e. not inside /* Imported declarations must not be in a local context (i.e. not inside
a function). */ a function). */
if (context != NULL_TREE && node->force_global > 0) if (context && node->force_global > 0)
{ {
tree ctx = context; tree ctx = context;
while (ctx != NULL_TREE) while (ctx)
{ {
gcc_assert (TREE_CODE (ctx) != FUNCTION_DECL); gcc_assert (TREE_CODE (ctx) != FUNCTION_DECL);
ctx = (DECL_P (ctx)) ctx = DECL_P (ctx) ? DECL_CONTEXT (ctx) : TYPE_CONTEXT (ctx);
? DECL_CONTEXT (ctx)
: TYPE_CONTEXT (ctx);
} }
} }
/* If FORCE, we want to get rid of all nodes in the queue: in case there /* If FORCE, we want to get rid of all nodes in the queue: in case there
was no elaborated scope, use the global context. */ was no elaborated scope, use the global context. */
if (force && context == NULL_TREE) if (force && !context)
context = get_global_context (); context = get_global_context ();
if (context != NULL_TREE) if (context)
{ {
tree t; tree t;
int i; int i;
...@@ -4514,11 +4513,11 @@ convert (tree type, tree expr) ...@@ -4514,11 +4513,11 @@ convert (tree type, tree expr)
if (TYPE_IS_THIN_POINTER_P (etype) && TYPE_IS_THIN_POINTER_P (type)) if (TYPE_IS_THIN_POINTER_P (etype) && TYPE_IS_THIN_POINTER_P (type))
{ {
tree etype_pos tree etype_pos
= TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (etype)) != NULL_TREE = TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (etype))
? byte_position (DECL_CHAIN (TYPE_FIELDS (TREE_TYPE (etype)))) ? byte_position (DECL_CHAIN (TYPE_FIELDS (TREE_TYPE (etype))))
: size_zero_node; : size_zero_node;
tree type_pos tree type_pos
= TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type)) != NULL_TREE = TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (type))
? byte_position (DECL_CHAIN (TYPE_FIELDS (TREE_TYPE (type)))) ? byte_position (DECL_CHAIN (TYPE_FIELDS (TREE_TYPE (type))))
: size_zero_node; : size_zero_node;
tree byte_diff = size_diffop (type_pos, etype_pos); tree byte_diff = size_diffop (type_pos, etype_pos);
...@@ -6107,7 +6106,7 @@ def_builtin_1 (enum built_in_function fncode, ...@@ -6107,7 +6106,7 @@ def_builtin_1 (enum built_in_function fncode,
/* Preserve an already installed decl. It most likely was setup in advance /* Preserve an already installed decl. It most likely was setup in advance
(e.g. as part of the internal builtins) for specific reasons. */ (e.g. as part of the internal builtins) for specific reasons. */
if (builtin_decl_explicit (fncode) != NULL_TREE) if (builtin_decl_explicit (fncode))
return; return;
gcc_assert ((!both_p && !fallback_p) gcc_assert ((!both_p && !fallback_p)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* * * *
* C Implementation File * * C Implementation File *
* * * *
* Copyright (C) 1992-2015, Free Software Foundation, Inc. * * Copyright (C) 1992-2016, Free Software Foundation, Inc. *
* * * *
* GNAT is free software; you can redistribute it and/or modify it under * * 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- * * terms of the GNU General Public License as published by the Free Soft- *
...@@ -223,8 +223,8 @@ find_common_type (tree t1, tree t2) ...@@ -223,8 +223,8 @@ find_common_type (tree t1, tree t2)
|| (TYPE_SIZE (t1) == TYPE_SIZE (t2) || (TYPE_SIZE (t1) == TYPE_SIZE (t2)
&& !(TREE_CODE (t1) == RECORD_TYPE && !(TREE_CODE (t1) == RECORD_TYPE
&& TREE_CODE (t2) == RECORD_TYPE && TREE_CODE (t2) == RECORD_TYPE
&& get_variant_part (t1) != NULL_TREE && get_variant_part (t1)
&& get_variant_part (t2) == NULL_TREE)))) && !get_variant_part (t2)))))
return t1; return t1;
/* Otherwise, if the lhs type is non-BLKmode, use it. Note that we know /* Otherwise, if the lhs type is non-BLKmode, use it. Note that we know
...@@ -852,7 +852,7 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -852,7 +852,7 @@ build_binary_op (enum tree_code op_code, tree result_type,
{ {
case INIT_EXPR: case INIT_EXPR:
case MODIFY_EXPR: case MODIFY_EXPR:
gcc_checking_assert (result_type == NULL_TREE); gcc_checking_assert (!result_type);
/* If there were integral or pointer conversions on the LHS, remove /* If there were integral or pointer conversions on the LHS, remove
them; we'll be putting them back below if needed. Likewise for them; we'll be putting them back below if needed. Likewise for
...@@ -2408,7 +2408,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc, ...@@ -2408,7 +2408,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
} }
/* Indicate that we need to take the address of T and that it therefore /* Indicate that we need to take the address of T and that it therefore
should not be allocated in a register. Returns true if successful. */ should not be allocated in a register. Return true if successful. */
bool bool
gnat_mark_addressable (tree t) gnat_mark_addressable (tree t)
...@@ -2704,7 +2704,7 @@ gnat_rewrite_reference (tree ref, rewrite_fn func, void *data, tree *init) ...@@ -2704,7 +2704,7 @@ gnat_rewrite_reference (tree ref, rewrite_fn func, void *data, tree *init)
break; break;
case COMPOUND_EXPR: case COMPOUND_EXPR:
gcc_assert (*init == NULL_TREE); gcc_assert (!*init);
*init = TREE_OPERAND (ref, 0); *init = TREE_OPERAND (ref, 0);
/* We expect only the pattern built in Call_to_gnu. */ /* We expect only the pattern built in Call_to_gnu. */
gcc_assert (DECL_P (TREE_OPERAND (ref, 1)) gcc_assert (DECL_P (TREE_OPERAND (ref, 1))
...@@ -2778,7 +2778,7 @@ get_inner_constant_reference (tree exp) ...@@ -2778,7 +2778,7 @@ get_inner_constant_reference (tree exp)
break; break;
case COMPONENT_REF: case COMPONENT_REF:
if (TREE_OPERAND (exp, 2) != NULL_TREE) if (TREE_OPERAND (exp, 2))
return NULL_TREE; return NULL_TREE;
if (!TREE_CONSTANT (DECL_FIELD_OFFSET (TREE_OPERAND (exp, 1)))) if (!TREE_CONSTANT (DECL_FIELD_OFFSET (TREE_OPERAND (exp, 1))))
...@@ -2788,8 +2788,7 @@ get_inner_constant_reference (tree exp) ...@@ -2788,8 +2788,7 @@ get_inner_constant_reference (tree exp)
case ARRAY_REF: case ARRAY_REF:
case ARRAY_RANGE_REF: case ARRAY_RANGE_REF:
{ {
if (TREE_OPERAND (exp, 2) != NULL_TREE if (TREE_OPERAND (exp, 2) || TREE_OPERAND (exp, 3))
|| TREE_OPERAND (exp, 3) != NULL_TREE)
return NULL_TREE; return NULL_TREE;
tree array_type = TREE_TYPE (TREE_OPERAND (exp, 0)); tree array_type = TREE_TYPE (TREE_OPERAND (exp, 0));
...@@ -2917,7 +2916,7 @@ gnat_invariant_expr (tree expr) ...@@ -2917,7 +2916,7 @@ gnat_invariant_expr (tree expr)
switch (TREE_CODE (t)) switch (TREE_CODE (t))
{ {
case COMPONENT_REF: case COMPONENT_REF:
if (TREE_OPERAND (t, 2) != NULL_TREE) if (TREE_OPERAND (t, 2))
return NULL_TREE; return NULL_TREE;
invariant_p |= DECL_INVARIANT_P (TREE_OPERAND (t, 1)); invariant_p |= DECL_INVARIANT_P (TREE_OPERAND (t, 1));
break; break;
...@@ -2925,8 +2924,8 @@ gnat_invariant_expr (tree expr) ...@@ -2925,8 +2924,8 @@ gnat_invariant_expr (tree expr)
case ARRAY_REF: case ARRAY_REF:
case ARRAY_RANGE_REF: case ARRAY_RANGE_REF:
if (!TREE_CONSTANT (TREE_OPERAND (t, 1)) if (!TREE_CONSTANT (TREE_OPERAND (t, 1))
|| TREE_OPERAND (t, 2) != NULL_TREE || TREE_OPERAND (t, 2)
|| TREE_OPERAND (t, 3) != NULL_TREE) || TREE_OPERAND (t, 3))
return NULL_TREE; return NULL_TREE;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment